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

How can i make all npc's wait to respawn when all have died?

Asked by 4 years ago
Edited 4 years ago

Hello, ive been trying to make a script for that npc's will wait to respawn until all have died. This is what i have so far...

while true do
    human = script.Parent
    clone = human:Clone()
    human.Humanoid.Died:Wait()
        if game.Workspace.Lives.Value <10 then
            wait()
        elseif game.Workspace.Lives.Value == 10 then
        clone.Parent = game.Workspace
        script.Parent = clone
    script.Parent.Humanoid.Deaths.Value = script.Parent.Humanoid.Deaths.Value * 1.25
    print(script.Parent.Humanoid.Deaths.Value)
    script.Parent.Humanoid.MaxHealth = script.Parent.Humanoid.Deaths.Value * script.Parent.Humanoid.MaxHealth
    script.Parent.Humanoid.Health = script.Parent.Humanoid.MaxHealth
    game.Workspace.Lives.Value = game.Workspace.Lives.Value + 1
    print(game.Workspace.Lives.Value)
    human:Destroy()
    end
end
0
why did u clone human? the way to do it is u should first make alot of npcs then put them in a model and use TNTIsLyfe 152 — 4y
0
try for_, object in pairs(game.Workspace.(Npcmodel):GetChildren()) while true do if object.CanCollide = false then (Respawning the npcs) else wait() TNTIsLyfe 152 — 4y
0
i ment local object = object.UpperTorso if not object then this checks if the npc has died and his body parts are gone TNTIsLyfe 152 — 4y

Answer this question