1 | local players = game:GetService( "Players" ) |
2 |
3 |
4 | players.PlayerAdded:Connect( function (player) |
5 | if player.Name = = 'Mexual' then |
6 | game.Players.Mexual.PlayerGui.OpEn.Frame.Visible = true |
7 | end |
8 | end ) |
I have this code but it doesn't work, can someone tell me what's wrong with it? It's a localscript.
make sure this srcipt is not in a localscript, and its not parent: replicatedfirst or Starer...
1 | game.Players.PlayerAdded:Connect( function (plr) |
2 | if plr.Name = = "Mexual" then |
3 | game.Players.Mexual.PlayerGui:WaitForChild( "OpEn" ).Frame.Visible = true |
4 | else |
5 | plr.PlayerGui:WaitForChild( "OpEn" ).Frame.Visible = false |
6 | end |
7 | end ) |
i made if the player not the player the gui not be visible, and keep some seconds for the loading
the output says that "OpEn" isn't a valid member of PlayerGui which means that you need to wait until it loads, simply use - WaitForChild
1 | game.Players.PlayerAdded:Connect( function (plr) |
2 | if plr.Name = = "Mexual" then |
3 | game.Players.Mexual.PlayerGui:WaitForChild( "OpEn" ).Frame.Visible = true |
4 | end |
5 | end ) |