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
7 years ago
Edited 7 years ago

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

local id = 3081313

game.Players.PlayerAdded:connect(function(newPlayer)
   if newPlayer:IsInGroup(id) then                    
    game.Players.newPlayer.PlayerGui.PCgui.Inventory.Weapons.Show.Rock2.Visible = true
    else
       print("NOPE")
    end
end)

-Thanks in advance!

1 answer

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

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

local id = 3081313

game.Players.PlayerAdded:connect(function(newPlayer)
   if newPlayer:IsInGroup(id) then                    
       newPlayer.PlayerGui.PCgui.Inventory.Weapons.Show.Rock2.Visible = true
   else
       print("NOPE")
    end
end)

0
To clarify, newPlayer is a VARIABLE name, not the name of the Player. After all, your username isn't newPlayer. Perci1 4988 — 7y
0
Oh. Thanks! Admin8483 -21 — 7y
Ad

Answer this question