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?
01 | events.LeaveLobby.OnServerInvoke = ( function (player, id) |
02 | if lobbies [ id ] then |
03 | print (lobbies [ id ] .Host) -- Prints Omar_Hopman |
04 | print (player.Name) -- Prints Omar_Hopman |
05 | local host = lobbies [ id ] .Host |
06 | local playername = player.Name |
07 |
08 | if playername = = host then |
09 | print ( "Player is host deleting lobby" ) |
10 |
11 | table.remove(lobbies, id) |
12 | events.UpdateLobbies:InvokeClient() |
13 | elseif playername ~ = host then |
14 | print ( "Player is not host removing player" ) |
15 |
In line 05
, is lobbies[id].Host
an Instance
(an object that can be seen in the Workspace), or is it a StringValue
? If it's an Instance, try lobbies[id].Host.Name
to make it a string.