I am trying to make a game in Roblox that spawns every player onto a map and they have to try kill each other. However my problem is when the last player is left I don't know how to spawn him back in my lobby. I have all the players in the game stored in an array, once a person dies they are removed from the array. I have tried setting the last players health to 0 but whatever way the player is stored in the array it won't work with getting their humanoid.
This is my code so far:
if #plrs == 1 then
plrs[1].Character.Humanoid.Health = 0
end
I am making my plrs array like this:
local plrs = {}
for i, player in pairs(game.Players:GetPlayers()) do
if player then
table.insert(plrs,player) --Add each player to the Player array
end
end
Thank you for any help.
plrs
array? – Nifim