So I've been looking for an answer to this for a few hours and i haven't been able to find ANYTHING. I want the player to drown after being under water for (x) amount of seconds. But i don't know how to even get started, or where to put the script.
COMMUNITY QUESTION
How to make player drown after being underwater for (x) amount of time?
1 answer
Here's what you can do:
Use a https://developer.roblox.com/en-us/api-reference/event/Humanoid/StateChanged to detect when the player is Swimming.
When they are detected to be swimming, you can start counting down on a timer. When the humanoid's state is changed to something other then swimming, cancel the timer. If the timer reaches 0, you can kill the player.
This discussion is preserved as it was. New answers, comments, and votes are closed.

2 comments
where do i put the script?
Anywhere. Make sure it's a server script.