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

Will calleing a function on a newPlayer be able to edit something in their player gui?

Asked by
Admin8483 -21
8 years ago
Edited 8 years ago

I need to know if this code will let me access the player by using newPlayer

1local id = 3081313
2 
3game.Players.PlayerAdded:connect(function(newPlayer)
4   if newPlayer:IsInGroup(id) then                   
5    game.Players.newPlayer.PlayerGui.PCgui.Inventory.Weapons.Show.Rock2.Visible = true
6    else
7       print("NOPE")
8    end
9end)

-Thanks in advance!

1 answer

Log in to vote
0
Answered by
uhTeddy 101
8 years ago

You will not be able to do game.players.Newplayer you need to use the variable NewPlayer for example:

1local id = 3081313
2 
3game.Players.PlayerAdded:connect(function(newPlayer)
4   if newPlayer:IsInGroup(id) then                   
5       newPlayer.PlayerGui.PCgui.Inventory.Weapons.Show.Rock2.Visible = true
6   else
7       print("NOPE")
8    end
9end)
0
To clarify, newPlayer is a VARIABLE name, not the name of the Player. After all, your username isn't newPlayer. Perci1 4988 — 8y
0
Oh. Thanks! Admin8483 -21 — 8y
Ad

Answer this question