I was making a game, and I made a Number of players chart. I made a script that shows how many players are alive, but didn't a way to tell how many players were alive yet, but that's besides the point. I used the script: ((Local Script))
local players = {}
game.Players.PlayerAdded:Connect(function(plr)
game.Players:WaitForChild(plr)
table.insert(players,#players+1, plr.Name)
end)
game.Players.PlayerRemoving:Connect(function(plr)
game.Players:WaitForChild(plr)
table.remove(players, #players)
end)
print(#players)
while wait() do
script.Parent.Text = "0".."/"..#players-1
end
And it set the the text to "0/-1" and it printed "0" I also tried to fix it myself by adding:
game.Players:WaitForChild(plr)
--and
print(#players)
But as you can see, that didn't work. I don't know how to fix it, please help me.

3 comments
alternatively, you can write script.Parent.Text = "0".."/"..#game.Players:GetPlayers(). i thought you wanted a list of the player names earlier so that's why i wrote the script like i did above. my bad. glad you got your script working though
oh okay, also the reason why I keep putting (-1) is because someone is gonna be a killer and it wouldn't make sense to count the killer as a survivor
did this work? please mark it as accepted if it works.