Observations:
When pressing the jump key to swim upwards in water, behavior does not match regular swimming behavior. It appears to use a speed metric that is not tied to the humanoid’s WalkSpeed or JumpPower. When disabling the Jump state, the outcome does not change. When setting Humanoid.WalkSpeed to 0, Swimming speed is also 0 as expected, however, swimming up with the jump key still allows the player to swim up to the surface (while also passively floating upwards as usual). Additionally, this unknown metric seems to be incorrectly tied to the player’s framerate, as this upwards speed increases with framerate.
Video Examples:
In both videos, the following script is attached to the player character for testing purposes. Jump is disabled, and when the player holds space, WalkSpeed is set to 0 (and back to 16 afterwards). If the speed from the signal Humanoid.Swimming is higher than 20, the speed is printed.
char = script.Parent
humanoid = char.Humanoid
humanoid.Swimming:connect(function(speed)
if speed > 20 then
print(speed)
end
end)
UIS = game:GetService("UserInputService")
UIS.InputBegan:connect(function(input)
if input.KeyCode == Enum.KeyCode.Space then
humanoid.WalkSpeed = 0
end
end)
UIS.InputEnded:connect(function(input)
if input.KeyCode == Enum.KeyCode.Space then
humanoid.WalkSpeed = 16
end
end)
humanoid:SetStateEnabled(Enum.HumanoidStateType.Jumping, false)
In Video 1, Framerate is set to 60fps. When the player presses space in the water, they can no longer swim using movement keys as expected. However, they still swim upwards, though at a reasonable speed.
In Video 2, Framerate is set to 165fps. When the player presses space, once again they can no longer swim using movement keys, but they still swim upwards… this time as a staggeringly high speed (max: 31) as the number has scaled with framerate for unknown reasons (again, WalkSpeed is 0 and Jump is also disabled, so the source of this velocity is from a different, undisclosed variable.)
Additionally note, In Video 3, the player is holding an anchor which sets the density of their character baseParts to 20. At 60fps, this makes it impossible to swim upwards. At 165, the player can overcome this heaviness with ease.
Expected behavior
If everything was working as expected, then this upwards swimming velocity would be tied to WalkSpeed as normal swimming speed is in every other case. If Walkspeed is set to 0, then this motion should be disabled just like any other swimming motion. The speed should be the same at all framerates.