Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How to make player drown after being underwater for (x) amount of time?

Asked by 4 years ago

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.

1 answer

Log in to vote
1
Answered by
Raccoonyz 1092 Donator Moderation Voter
4 years ago

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.

0
where do i put the script? mohawk2005ishacked12 13 — 4y
0
Anywhere. Make sure it's a server script. Raccoonyz 1092 — 4y
Ad

Answer this question