I'm creating a lobby system, I want to check if the player if the host if so then we'll remove the entire lobby. While I'm the host it doesn't say so?
events.LeaveLobby.OnServerInvoke = (function(player, id)
if lobbies[id] then
print(lobbies[id].Host) -- Prints Omar_Hopman
print(player.Name) -- Prints Omar_Hopman
local host = lobbies[id].Host
local playername = player.Name
if playername == host then
print("Player is host deleting lobby")
table.remove(lobbies, id)
events.UpdateLobbies:InvokeClient()
elseif playername ~= host then
print("Player is not host removing player")
table.remove(lobbies[id].Players, table.find(lobbies[id].Players, player.Name))
for i, p in ipairs(game.Players:GetChildren()) do
events.UpdateLobbies:InvokeClient(p, lobbies)
end
end
else
warn("Lobby not found with ID " .. id)
end
print(lobbies)
end)

1 comment
What is the 'lobbies' variable? is it a table, folder, etc..?