I'm testing outside ROBLOX Studio, it won't respawn once I attacked the humanoid. (Not a dummy, a real player)
Do I have to put p.Parent.Humanoid.Health == 0 ? I didn't use LocalScript, I used the normal script inside the tool.
local CanDamagePlayers = true local damage = 3 script.Parent.Top.Touched:connect(function(p) if p.Parent:FindFirstChild("Humanoid") and CanDamagePlayers == true and p.Parent.Humanoid.Health > 0 then local plr = game.Players:GetPlayerFromCharacter(script.Parent.Parent) p.Parent.Humanoid:TakeDamage(damage) script.Parent.Sound:Play() plr.leaderstats.Pins.Value = plr.leaderstats.Pins.Value + 4 CanDamagePlayers = false wait(1) CanDamagePlayers = true end end)
To make an npc respawn do this
while true do local npc = game.Workspace.Zombie -- The Zombie can be changed to the name of ur npc local respawnPos = (0,0,0) --Obviously change this if npc.Health == 0 then npc.Position = Vector3.new(respawnPos) end end