-- tween the sound to the speed

local tween = game:GetService("TweenService"):Create(waterSound,TweenInfo.new(1,Enum.EasingStyle.Linear,Enum.EasingDirection.In),{["Volume"] = math.clamp(speed/maxSpeed,0,1)}) -- end of tweencreate
tween:Play()
if speed > 0.01 and not swim.IsPlaying then
swim:Play()
elseif speed <0.01 and swim.IsPlaying then
swim:Stop()
end

end
