Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

why doesn't my Debounce work? I think i typed it right?

local thispart = script.Parent
local Debounce = false
function oof(theplayer)
	if theplayer.Parent:FindFirstChild("Humanoid", false) and Debounce == false then
    Debounce = true
	theplayer.Parent.Humanoid.Health = theplayer.Parent.Humanoid.Health - 10
	print("you're dying")
	Debounce = false
	wait(2)
	end
	if theplayer.Parent.Humanoid.Health == 0 and Debounce == false then
		Debounce = true
		print("game over!")
		Debounce = false
		wait(1000)
	end
end
thispart.Touched:Connect(oof)

this doesn't work for some reasons

2 comments

0

Could you elaborate on what’s not working?

0

it prints you're dying for 77 times when i touched the part :/

1 answer

✓ Accepted answer

You need to reset the debounce AFTER the wait() function, if you reset the debounce before wait() then its pointless since there will be no delay.

This discussion is preserved as it was. New answers, comments, and votes are closed.