I'm trying to make a roblox gui only visible to me and a few friends, however the first comma in the script has an error. The error says "Expected 'then' when parsing if statement, got ',' .
Here is the Code:
1 | if game.Players.LocalPlayer = = { "ThrashIsDead" , "poophead27272" , "darkslayer741" } then |
2 | script.Parent.Visible = true |
3 | else |
4 | script.Parent.Visible = false |
Help would be greatly appreciated. I've been struggling with this for some time now, but can't seem to figure it out.
You're comparing an instance with a table. Here, use table.find
:
1 | local Table_Of_Names = { "ThrashIsDead" , "poophead27272" , "darkslayer741" } ; |
2 | if table.find(Table_Of_Names,game:service 'Players' .LocalPlayer.Name) then |
3 | print 'Oh wow' |
4 | end ; |
You're using squiggly brackets like it's a table. Also you're comparing string to an object value. Idk if using 'or' or a comma makes a difference though.
1 | script.Parent.MouseButton 1 Click:connect( function () |
2 | if game.Players.LocalPlayer.Name = = ( "Edbotikx" or "poophead27272" or "darkslayer741" ) then |
3 | script.Parent.Visible = true |
4 | print "visible" |
5 | else |
6 | script.Parent.Visible = false |
7 | print "not" |
8 | end |
9 | end ) |