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

[UNANSWERED] Why won't my GUI work when accessing it in ServerScriptService?

Asked by 10 years ago

Please make your question title relevant to your question content. It should be a one-sentence summary in question form.
function Start()
    for i = 10, 0, -1 do
        game.StarterGui.Intermission.TextLabel.Text = "Game beginning in "..i
        wait(1)
    end
end

while true do
    if game.Players.NumPlayers >= 3 then
        wait(1)
        Start()
    end
    wait()
end
1
StarterGui is just the Gui that is given when a player spawns. It doesn't update live with all clients. Tkdriverx 514 — 10y

3 answers

Log in to vote
0
Answered by 10 years ago

If you're testing it as a player, that's because what is in the StarterGui does not automatically update with every player. The StarterGui is what's replicated into a player's PlayerGui when they spawn. Here is an edited version of your script:

function Start()
    for i = 10, 0, -1 do
    for i, player in pairs(game.Players:GetPlayers()) do
        if player:FindFirstChild("PlayerGui") and player.PlayerGui:FindFirstChild("Intermission") then
                player.PlayerGui.Intermission.TextLabel.Text = "Game beginning in "..i
        end
    end
        wait(1)
    end
end


while true do
    if game.Players.NumPlayers >= 3 then
        wait(1)
        Start()
    end
    wait()
end
0
This isn't suggested, but would work. For use with FilteringEnabled, it is suggested to use a RemoteEvent fired from the server and handled in a LocalScript. cheaterdude12 125 — 10y
Ad
Log in to vote
1
Answered by
Merely 2122 Moderation Voter Community Moderator
10 years ago

StarterGui is just a container for GUIs. Whenever a player spawns, the ROBLOX engine automatically makes a copy of everything in StarterGui and pastes it into the Player's PlayerGui object. That's why you don't see any affect when you change the properties of an object in StarterGui.

Log in to vote
0
Answered by 10 years ago

The startergui will update, but Not update playerguis.

Answer this question