Hello! I am making a roblox game like subnautica, though we are stuck on one thing. I need help with a breathing script, like player can be underwater for 10 sec, after that they get damaged 10 hp each extra second. Anyone knows how to make something like this? Thanks!
So you can make a touched event for terrain, it will look a little bit like (not writing real lua code because you haven't attempted it yet):
water = 2048 -- the material code for water int underwater = 0--have it count up for every second under the water if player touches terrain and terrain's material value is 2048 then if underwater > 10 then do damage to the player's humanoid wait(1)--make it wait a second before checking again end end
Closed as Not Constructive by yHasteeD and Zafirua
This question has been closed because it is not constructive to others or the asker. Most commonly, questions that are requests with no attempt from the asker to solve their problem will fall into this category.
Why was this question closed?