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

Why do I have to jump for the debounce in my kill brick to work?

So lately Ive been trying to make an ocean work so it kills you over time. I have a debounce that is checked when you touch the ocean, if it is false, it will set it to true and damage you (and wait 0.5 seconds to reset debounce to false) but for some reason, you have to jump for it to take damage on you again. I swear I've used this method before and have it work perfectly. Help would be great! (script is serversided, and inside the ocean part (canTouch is on))

local debounce = false

script.Parent.Touched:Connect(function(hit)
	if hit.Parent:FindFirstChild("Humanoid") ~= nil then
		if debounce == false then
			hit.Parent.Humanoid.Health = hit.Parent.Humanoid.Health - 10
			
			debounce = true
			wait(0.5)
			debounce = false
		end
	end
end)

1 answer

✓ Accepted answer

I'm no roblox physics expert, but the problem here is most likely that a Touched only fires when two moving parts collide. If they are both at a standstill, the event will not fire. Again, I'm no roblox physics expert, so I don't know exactly how to fix this problem, but your best bet would probably be to use a Region3 instead of a Touched event.

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