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

How to make NPC's respawn on their spawners when they die?

I am making a simple game where there are some NPC's in camps. For some reason i can't make that if they die, they respawn...

I have one script inside the NPC for the AI etc, and i want the respawn script to be inside the spawner, so not inside the NPC itself if that is possible.

Does someone know how to do this? Thanks

1 answer

Put this script in the npc

local npc = script.Parent
local npcclone = npc:Clone() --clones the npc
local hum = ncp:WaitForChild("Humanoid")
local repawntime = 5 --respawns the new npc after 5 seconds

hum.Died:connect(function()
	wait(respawntime)
	npcclone.Parent = workspace --puts the clone in workspace
	npc:Destroy() --destroys the dead npc
)

2 comments

0

thank you, ill try :D

0

This should work.

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