So I am trying to make an NPC that kills you then makes you into a zombie but when I try to do this it just keeps cloning the player over and over again. No error prints
local debounce = false script.Parent.HumanoidRootPart.Touched:Connect(function(Touch) if Touch.Parent:FindFirstChild("Humanoid") ~= nil and debounce == false then debounce = true wait(1) Touch.Parent.Humanoid.Health = 0 local clone = Touch.Parent:Clone() clone.Parent = game.Workspace clone.Name = "Zombie" wait(5) debounce = false end end)
try this:
local debounce = false script.Parent.HumanoidRootPart.Touched:Connect(function(Touch) if Touch.Parent:FindFirstChild("Humanoid") and not debounce then debounce = true wait(1) Touch.Parent.Humanoid.Health = 0 local clone = Touch.Parent:Clone() wait(5) debounce= false clone.Parent = game.Workspace clone.Name = "Zombie" end end)
lemme know if it don't work