Dummy not dying from :TakeDamge(), even though I call it from a server script

Hello! this is probably a simple problem. Im trying to test out a damaging ability for my game, however when it kills the dummy im testing on, it doesnt die. I’m calling it from a server script, so i think it should be registering. Heres my code:

		hitbox.Touched:Connect(function(hit)
			if debounce == false then
				hit.Parent.Humanoid:TakeDamage(5)
				debounce = true
			end
		end)

Any help?

4 Likes

when do you turn debounce back to false

2 Likes

this is a function for when the ability happens, so I just set debounce to false before the touched event

2 Likes

Did you kill the dummy twice? If so you need to set Debounce to false.

Is there anything in the console?

1 Like

Any errors. If not, just look closely for loops or if statements that get the code stuck. And if nothing works, you can also use (and it’s not recommended)

hit.Parent.Humanoid.Health -= 5

Here why not try this it’ll still damage the humanoid:


	hitbox.Touched:Connect(function(hit)
			if debounce == false then
				hit.Parent.Humanoid.Health = hit.Parent.Humanoid.Health -5
				debounce = true
			end
		end)

I made a script for you. I hope this is what you want to achieve. You can change the debounce time. This is a normal script and its Parent should be Part .

local hitbox = script.Parent
local debounce = false

    hitbox.Touched:connect(function(hit)
    	if hit and hit.Parent and hit.Parent:FindFirstChild("Humanoid") and debounce == false then
    		debounce = true
    		hit.Parent.Humanoid.Health = hit.Parent.Humanoid.Health - 5
    		wait(1)
    		debounce = false
    	end
    end)