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

access the startgui?

Asked by 8 years ago

Hi I was trying to access the startergui from a script in the workspace. Can you help?

for _, player in pairs(players) do -- Cycles through all the objects, players or not, in the "Players" service object.
  if player:IsA("Player") then -- Makes sure it's a player, not some other object.
    local starterGui = player.StarterGui
    game.StarterGui.ScreenGui.TextLabel.Visible = true
  end
end

1 answer

Log in to vote
0
Answered by 8 years ago
for _, player in pairs(players) do
  if player:IsA("Player") then 
    local playerGui = player.PlayerGui
    game.StarterGui.ScreenGui.TextLabel.Visible = true
  end
end

This works because the original script was calling on the 'ScreenGu'i that is in game.StarterGui, whereas this script is calling on the Gui that the player gets when the server starts. Otherwise meaning, player.PlayerGui is the Gui that only that certain player can view. If that is complicated, reply and I will try to be more in-depth about it

0
doesn't work and no output... docrobloxman52 407 — 8y
Ad

Answer this question