I am attempting to make a drowning system for my game, but whenever a player touches another part, it just stops activating, how do I keep checking if a part is touching another (like every 5 seconds)
✓ ANSWER ACCEPTED
How do i continuously check if a part is touching another?
2 answers
✓ Accepted answer
You could try this
local debounce = false
script.Parent.Touched:connect(function(hit)
print("hit")
local player = game:GetService("Players"):GetPlayerFromCharacter(hit.Parent)
if player then
if debounce == true then return end
debounce = true
local check = player.Character:FindFirstChild("name here")
if not check then
--Enable the drowning here
local newValue= Instance.new("BoolValue")
newValue.Name = "name here"
newValue.Parent = player.Character
script.Parent.TouchEnded:wait()
--Disable it here
newValue()
end
debounce = false
end
end)
managed to do it with positions
This discussion is preserved as it was. New answers, comments, and votes are closed.

1 comment
"local check = player.Character:FindFirstChild("name here")"