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

3 comments

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

0

try for_, object in pairs(game.Workspace.(Npcmodel):GetChildren()) while true do if object.CanCollide = false then (Respawning the npcs) else wait()

0

i ment local object = object.UpperTorso if not object then this checks if the npc has died and his body parts are gone