just a quick question
im making a scuba diving game and i have made an air tank with a gui that looks like this
if i place a part with CanCollide
off, would i be able to make the air count down once the part is consistently touched
just a quick question
im making a scuba diving game and i have made an air tank with a gui that looks like this
if i place a part with CanCollide
off, would i be able to make the air count down once the part is consistently touched
You could use ZonePlus instead of having to rely on a part a player has to touch.
Yes. There’s another thing called CanTouch which allows other things to touch it and it to touch other things. CanCollide just lets you walk through
Yes you can.
Script should be something like
Part.Touched:Connect(function(Touched))
if game.Players:FindFirstChild(Touched.Parent) then
air -= 1
end
End)
Though you might want to add a debounc so it doesnt loop constantly or a wait()
is there any other way to do it?
That’s the way I’d do it, however you could also have a part below the water surface, and when a player crosses it their air supply will begin to decrease, but when they leave the water and touch that part it will stop.
If you have no caves that arent underwater, and all your water is set at a specific height on the Y level, you can make a loopthat checks if the player’s head is below the height of the water. This is the most simple way to do it.
I know a few more advanced ways but im typing this on mobile and it would be harder for me to provide an example.