How would I go about making water with a part

What I want to achieve is having water as a part.
When you jump onto the part you simply float to the top. Pressing space lets you descend down.
I would also wanna make sure the water is taller than a player. It wouldn’t make sense to float to the top of ankle-deep water.

1 Like

You’d want to use body movers like body gyro for this, detecting if user is pressing space while in water and if the water is X metres in height for the user to float on water or check if user’s HumanoidRootPart is touching the water

2 Likes

I have a good idea on how I wanna do most things but the current problem is what is the best way I should detect when a player touches the water, when they go under the water (to float them up), and when they exit the water. I also want to add a drowning system. So what would also be the most optimal way to check if the players head is under or above the water.

A way you could tell who’s heads are under the water, is by looping through all of the touching parts by using :GetTouchingParts(). Then, on each part that you detect is a head, you can see if it’s “under” the part by seeing if it’s Y position is lower than the surface of the water by doing something like:

if head.Position.Y < (water.Position.Y + (water.Size.Y / 2)) then
   --Drowning or floating code here.
end

Alternatively if you want to check if their head is fully submerged, you can do something like this:

if (head.Position.Y + (head.Size.Y / 2))  < (water.Position.Y + (water.Size.Y / 2)) then
    --Drowning or floating code here.
end