Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

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

Asked by
MediaHQ 53
3 years ago

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

Log in to vote
1
Answered by
iiAceMo 50
3 years ago
Edited 3 years ago

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

0
It does work but doesn't work for some reason on players MediaHQ 53 — 3y
Ad

Answer this question