-- Tweens volume for more dynamic shut off

local function TweenVolume(FromVolume,ToVolume,Duration,ShouldStopAfterTween)
	local CurrentSession = math.random(0,9999999)
	IsTweeningVolumeSession = CurrentSession
	for i=0,1,1/(Duration/0.03) do
		
		if IsTweeningVolumeSession ~= CurrentSession then
			return CurrentSession
		end
		
		local NewVol = FromVolume * (1-i) + ToVolume * i
		
		WaterLoop.Volume = NewVol
		
		wait()
	end
	
	WaterLoop.Volume = ToVolume
	
	if ShouldStopAfterTween then
		WaterLoop:Stop()
	end
end
