so i have a script that counts of players inside of a table called alive and if there is 0 then all players get teleported to the spawm location code
– countng fuction
local function Check2(tab)
local num = 0
for i= 1, #tab do
num += 1
end
return num
end
– checking function
for i = 1, Roatation do
if Check2(Alive) == 0 then
GivenPoints = true
print("G2")
for i = 1, #Finshed do
CalulateTickets(i)
end
break
end
ColourPickerSerivce.Run()
task.wait(3)
end
but for some reason if there is one player lefted the counter wont count it and they and all of the players get teleported to the spawn location
The part of the code which is the problem could’ve been in a different place then. What’s the code which handles registering the players into the table?
local function AddPlayersToAliveTabel()
print("Adding People To The Alive Table")
Status = "InProgess"
local AmoutPutIn = 0
for i, plr in ipairs(game.Players:GetPlayers()) do
table.insert(Alive,plr.UserId)
AmoutPutIn += 1
end
print("AddIng"..AmoutPutIn)
return
end
i firgue i had to to rescript a bit because the counting is just broken so i had to put a tag on a player and if they die they lose it and if they finsh they lose it