I'm setting up a swimming system where you can't Swim past the OceanLevel(being the Y height of the water maximum) As it is, its really jittery and I've tried ways in making it smooth(no jittery motions) but its always crashed the script(not the game)
OceanLevel.Value = -12.1 Angle is the Y angle of the players camera movement.(whichever movement) == 1(means true) Feel like its the way "Player.Character:MoveTo" works that makes it jittery but that's a personal assumption
if (script.IsSwimming.Value == true and Human.Position.Y > OceanLevel.Value and angle >= 0) or
(script.IsSwimming.Value == true and Human.Position.Y > OceanLevel.Value and angle <= 0 and movement.backward == 1) or
(script.IsSwimming.Value == true and Human.Position.Y > OceanLevel.Value and angle <= 0 and movement.upward == 1) or
(script.IsSwimming.Value == true and Human.Position.Y > OceanLevel.Value and angle <= 0 and movement.upward == 1 and movement.forward == 1)
then
Player.Character:MoveTo(Vector3.new(Human.Position.X, OceanLevel.Value, Human.Position.Z))
end
Any advice/tips on fixing this would be a great help!

2 comments
try using something like Heartbeat so it wont look jittery on the client, it doesnt matter much if its jittery on the server cause no one will be seeing it.
Does Heartbeat run faster then while wait() do? or is it something different?