Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

If statements says values aren't equal while they are?

Asked by 2 years ago
Edited 2 years ago

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?

Output

01events.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 
View all 26 lines...
0
What is the 'lobbies' variable? is it a table, folder, etc..? loowa_yawn 383 — 2y

1 answer

Log in to vote
2
Answered by
boredlake 256 Moderation Voter
2 years ago
Edited 2 years ago

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.

Ad

Answer this question