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

How do you get the PlayerGui in players?

Asked by 8 years ago

So I have this

    players = game.Players:GetChildren()
        count = game.StarterGui.countdown
        counting = count:Clone()
        counting.Parent = players.PlayerGui

    wait(.5)
        players.PlayerGui.countdown.Frame.Visible = true 

countdown is a Gui that I want to be visible when it activates. So uh, am I doing it right?

1 answer

Log in to vote
1
Answered by 8 years ago

Your code was a bit off.

You need to add a for loop to check all the players.

players = game.Players:GetChildren()
for index, value in pairs(players) do --Special function that checks all children of the players
    count = game.StarterGui.countdown
    counting = count:Clone()
    counting.Parent = value:WaitForChild("PlayerGui")--Waits for the PlayerGui to load
    value:WaitForChild("PlayerGui").countdown.Frame.Visible = true 
end

If you are still unclear visit this wiki page: http://wiki.roblox.com/index.php?title=Function_dump/Basic_functions&redirect=no#pairs

0
Still doesn't seem to be working... This is what the output says, YesIamBack 5 — 8y
0
What does the output say? I edited an error I made in the script, it should work. UniversalDreams 205 — 8y
0
Whoops! What you wrote was correct! Thank you and sorry :> YesIamBack 5 — 8y
Ad

Answer this question