Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

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

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

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)

2 comments

0

To clarify, newPlayer is a VARIABLE name, not the name of the Player. After all, your username isn't newPlayer.

0

Oh. Thanks!

This discussion is preserved as it was. New answers, comments, and votes are closed.