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

how can i make a bots respawn,fight?

im trying to make like 2 team 1 team bots like npc zombies and tanks etc and the other noob team with npcs and tanks too but they wont look the same like but i cannot find any tutorials

1 answer

✓ Accepted answer

The only way to is when they're loaded, they get a copy of themselves so they can respawn when they die. (Replace NPC where your NPC is in the game.)

local respawnclone =  [NPC]:Clone().Parent = nil

Then, we need to tell Lua to put that clone when the NPC dies. Here's how we'll do that

while true do wait(.1)
	if [NPC].Humanoid.Health == 0 then
		wait(5)
		respawnclone.Parent = workspace
		[NPC (The one that died)]:Destroy()
	end
end
--[[You can use a "died" event btw]]--

There, that should do it. I would recommend to put the script in the NPC, so it's put with the NPC respawned.
Regards, Vivilian9

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