I have changed allot of things in the script, but it is still not working, there is no error Output so I don't know what the problem is, but, the problem is that it is not respawning an NPC, and when it does, the player just dies, or falls through the baseplate, so it repeatedly loops over and over again, here is the script;
repeat wait() until script and script.Parent and script.Parent:FindFirstChild("Zombie") print("Respawned") wait(1) repeat wait(.2) if script.Parent.Zombie.Health <= 0 then print("Respawning") local Respawn = script.Parent:Clone() Respawn.Parent = game.Workspace Respawn:MakeJoints() script.Parent:Destroy() end until nil
The problem is that when you're cloning it, you're cloning it when it's already dead. Set the health back to 100.
repeat wait() until script and script.Parent and script.Parent:FindFirstChild("Zombie") local Respawn = script.Parent:Clone() print("Respawned") wait(1) repeat wait(.2) if script.Parent.Zombie.Health <= 0 then print("Respawning") Respawn.Parent = game.Workspace Respawn:MakeJoints() script.Parent:Destroy() end until nil
This should work.
Make sure your NPC is a Humanoid not a Zombie and clone it and make sure it's in workspace, for the other one you can delete it.