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

Updating a player's gui help?

Asked by
NotSoNorm 777 Moderation Voter
9 years ago

So I know that you can't change the startergui cause that's just inserted into the character when they join, how would I access the players gui and update this script from there

    for timewait = 2, 0, -1 do
        Players = game.Players:GetPlayers() --Define players
        wait(1)
        game.Workspace.StartingLine.Timer.SurfaceGui.Time.Text = "Picking Terrain"

        game.StarterGui.MainGui.TimeFrame.Timer.Text = "Picking Terrain" --The part that needs to go to the playergui not startergui

    endi
    end

1 answer

Log in to vote
0
Answered by 9 years ago

To answer your question quickly, you never cycle through the players, only change the starting gui, not their gui. To fix use this script:

for timeWait = 2, 0, -1 do
    for _, Player in pairs(game.Players:GetPlayers()) do
        Player.PlayerGui.MainGui.TimeFrame.Timer.Text = "Picking Terrain"
    end
    workspace.StartingLine.Time.SurfaceGui.Time.Text = "Picking Terrain"
    wait(1)
end
0
It should be noted that GetPlayers is quicker than using GetChildren and checking if the current value in the loop is a player. Spongocardo 1991 — 9y
0
thanks NotSoNorm 777 — 9y
Ad

Answer this question