Hello, I'm creating a shooting range and there are moving dummies inside it, and I'd like them to respawn after they have died, is there a way to respawn them? I tried using LoadCharacter but that only applies to Player. A response would be great, thanks!
local NPC = script.Parent local Humanoid = NPC:WaitForChild("Humanoid") Humanoid.Died:Connect(function() local NewNPC = game.ReplicatedStorage.Dummy:Clone() NewNPC.Parent = workspace NewNPC.HumanoidRootPart.Position = Vector3.new(X,Y,Z) NPC:BreakJoints() spawn(function() wait() NPC:Destroy() end) end)
Where it says: NewNPC.HumanoidRootPart.Position = Vector3.new(X,Y,Z) change X,Y, and Z to your choice. If you want it to spawn in a random position, do NewNPC.HumanoidRootPart.Position = Vector3.new(math.random(-X,X),Y,math.random(-Z,Z))