Making a Character Swim Outside of Terrain Water

This tutorial covers how to make a character swim outside of terrain water. I struggled with this for a bit and the question seems to be mostly unanswered on this forum, so I’m providing a solution here. This code should make a character swim as if they were in terrain water.

The following lines should be placed in a local script. Humanoid references the Humanoid object in the players character.

When you want to make the character start swimming:

Humanoid:SetStateEnabled("GettingUp", false)
Humanoid:ChangeState("Swimming")

The GettingUp state must be disabled because the roblox character will automatically get up if it is swimming and not in terrain water.

Then, when you want the character to stop swimming, just call

Humanoid:SetStateEnabled("GettingUp", true)

The character will automatically get up if it is not in water.

67 Likes

True! I remember when I had to figure out how to making a swimming system, it was super difficult.
For anyone wondering what it could look like, here’s something I made a while back, changing the states of the humanoid as well:

Swimming

4 Likes

could you provide us with a sample?

This might help: How to create terrain water behavior, without terrain water - #10 by FerbZides