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

how can i make a bots respawn,fight? [closed]

Asked by 5 years ago

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

Closed as Not Constructive by hiimgoodpack and CeramicTile

This question has been closed because it is not constructive to others or the asker. Most commonly, questions that are requests with no attempt from the asker to solve their problem will fall into this category.

Why was this question closed?

1 answer

Log in to vote
0
Answered by 5 years ago

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

Ad