lets say this is the script:
local plrTable = {}
local plrTableNextPos = 0
game.Players.PlayerAdded:Connect(function(Player)
plrTableNextPos = plrTableNextPos + 1
table.insert(plrTable, plrTableNextPos, Player.Name)
end)
game.Players.PlayerRemoving:Connect(function(Player)
plrTableNextPos = plrTableNextPos - 1
table.remove(plrTable, plrTableNextPos)
end)
... simple, right? BUT, what if I wanted to print "Empty server" when the table is empty. How do I know? heres what im thinking but this wont work (i know because I tried):
local plrTable = {}
local plrTableNextPos = 0
game.Players.PlayerAdded:Connect(function(Player)
plrTableNextPos = plrTableNextPos + 1
table.insert(plrTable, plrTableNextPos, Player.Name)
end)
game.Players.PlayerRemoving:Connect(function(Player)
plrTableNextPos = plrTableNextPos - 1
table.remove(plrTable, plrTableNextPos)
end)
if plrTable == nil then -- detect if table is empty part
print("Empty server")
end
how could i do this?

2 comments
You can use "next(table)", if it return "nil" then the table is nil, if return the first table element, then there is a player, other else, you can use "table[1] == nil", which just work for arrays.
thanks