Why is this simple damage script not working?

Can you provide the whole event section? Perhaps the problems lies there.

@Kamlkaze_Kid You’re attempting to compare the object’s parent against itself, which wont work as you’ve renamed hit to player.

EDIT
Oof, don’t know how I missed that code lol. Is the script disabled at all? Or is there something preventing the execution? Have you tried using a print to see what the Touched listener returns?

in the first post is the whole event unless you want to see my animations

Have you tried:

script.Parent.Handle.Blade.Touched:Connect(function(hit)
	if hit.Parent:FindFirstChild("Humanoid") then
		hit.Parent.Humanoid:TakeDamage(math.random(10, 50))
		script.Parent.Parent.Parent.Hit:Play()
	end
end)

?

1 Like

Try @xure1’s script (30 charsss)

yes i have

i really dont get why this doesnt work, because when i tried it before on a killbrick it worked, but when i try it against npcs (which are the only thing players are allowed to attack) it does not work

Make sure the npcs have a humanoid

1 Like


their
humanoid
is
called
npc
THANK YOU I KNOW WHY THIS DOESNT WORK I THINK!

also now that i think about it the npcs didnt take damage when they touched the killpart!

EDIT:

IT WORKED! TYSM this literally took me a month to figure out lel