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

How to make this NPC kill you then make you into a zombie?

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)

1 answer

✓ Accepted answer

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

1 comment

0

It does work but doesn't work for some reason on players

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