Check if player is in water

Hey guys, I have a simple question: How can I check if a player is in the water?
I already have most of the code I think. ( And yes, this time I’m letting you see it )

Current Code (Incomplete):
function WalkOnWater( ply )
if not ply:IsAdmin() then
for k, v in pairs(ents.FindByName(“water”)) do
– If ‘something here’ then
– code
– is there actually a hook? I don’t mind!

Anyway, I saw a cool video on youtube about someone walking on water. I was wondering if I could recreate it.
Also, if you even remotely find any of my code interesting, take it!

The above is badly coded, I will edit if I manage to get something working.


Wiki -> Entities -> Ctrl+F “Water”

For future reference.

If you’d ever played perp, players get killed at 3+ water level.

This seems to do it, thanks! Also, if it works, I will edit first post to show full code for everyone. Also, sorry about not checking the wiki

If you want walking on water, JSharpe recreated Sippelangelo’s script a long time ago.

Well, I guess I was going to recreate it my way, but you just spoiled it for me. Anyways thanks for the link.

This can also be a learning experience. So actually, I really thank you for pointing me in the right direction. Much appreciated.

Sorry, I just thought that in case you did want to reference it or anything, the link would be useful.