Hey, This script works fine, the only thing that does not work is the debounce, what is wrong?
The "dead" part should damage the player after the part have blinked and then just be a normal part again after 5 sec. But now it damage the player all the time, help.
while true do
wait(5)
debounce = false
script.Parent.Transparency = 1
wait(1)
script.Parent.Transparency = 0
wait(1)
script.Parent.Transparency = 1
wait(1)
script.Parent.Transparency = 0
wait(1)
debounce = true
if debounce == true then
script.Parent.Touched:Connect(function(hit)
local humanoid = hit.parent:FindFirstChild("Humanoid")
if humanoid then
humanoid.Health = humanoid.Health -1
end
end)
end
end
Thanks!

1 comment
"Touched" is an event, not a function. Also, it's never advisable to have an event listener in an infinite loop unless you are disconnecting it.