How would one tell if a player is under water?

Hi. I want to make a drowning system. I need to detect when the player is swimming and when they’re not, but I can’t figure out how. I can detect when the enter the water, with the Humanoid.Swimming event, but I can’t detect when they stop. Can someone help me? Also, Humanoid:GetState() won’t work, since they player can just jump out of the water.

1 Like

Create a part that covers the entire water area, and then use ZonePlus to determine if a player is in the water zone or not. This module is great and should help you out.

1 Like

That sounds a bit tedious. If I would do something like that, I’d just use :GetTouchingParts(). I am looking for a more simple and straight-forward way. Thanks for response, though!

Hey there, maybe this could help you:


First of all, don’t use :GetTouchingParts(). It’s broken and trash. ZonePlus is easy to use and has only like 2 functions :OnPlayerEnter() and :OnPlayerLeave(). It’s as easy as that.

GetTouchingParts() works, you just need to add a .Touched event to create an interest. But, as I said, since I’m looking for a more effective way, I won’t be using GetTouchingParts() anyways.

Have you tried the solution of the thread I linked?

Use GetPartsInPart which does the same except it returns all parts

Also, I don’t really know about it, but it can maybe be a solution Terrain:ReadVoxels I found this read voxels function which returns a table of materials, maybe you can use that

I was just looking at it. I think this may be a good solution. I’ll try it in a minute!

You can maybe check if the part is a player, and then get the bounding box of that player, then after you do that you can check all the available materials in such area and if there is a water material then it means the player is touching the water

I’m trying to avoid placing parts for where the water is, because its tedious and the water spaces I have are not spheres or cubes; they’re all twisting. Yes, I’m going to look into using region 3 in a moment. Thanks for your response!

Oh! wait I didn’t check that is what the post is suggesting

Why do you need parts? The terrain is a part

Because, I have more terrain than just water.

Yes, that is what I am saying, you get the parts in the part, then check if the part is a player. If it is then check the bounding box of that player and check if there is a water material inside the bounding box using ReadVoxels

Yes, I’m going to look into using region 3 in a moment. Thanks for your response!

Yes, I’m going to see if I can use Region3

1 Like

But like can you clarify, it is because I didn’t really understand. Why don’t you want the GetPartsInPart method?

I said using :GetPartsInParts() is too tedious, because I’d have to make parts and put them in the water.

1 Like

You can call that function using terrain

Again, as I’ve said, all terrain is grouped into one instance called ‘Terrain’, and I have more terrain than just water.

1 Like