I made a script to access a player's PlayerGui, the PlayerGui part is okay, but this part isn't, and I don't know why:
p = game.Players:GetPlayers() int = p.PlayerGui.Intermission.TextLabel
Could anyone help?
You are getting "PlayerGui" of a table which is nil since :GetPlayers() returns all players in the game in a table.
LocalScript:
You need to reference the local player with game.Players.LocalPlayer
:
local p = game.Players.LocalPlayer; local int = p.PlayerGui.Intermission.TextLabel;
Script:
You can reference the player instead with game.Players[playername]
local playername = "PiggyJingles"; local p = game.Players[playername]; local int = p.PlayerGui.Intermission.TextLabel;
You can use a loop to iterate through the players to find the player you want.
local player = "Grenaderade" for i,v in pairs(game.Players:GetPlayers()) if v.name == player then player = v break end end
Alternatively, you can use the PlayerAdded() event
game.Players.PlayerAdded:connect(function(player) print(player) end