Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

Updating a player's gui help?

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

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

2 comments

0

It should be noted that GetPlayers is quicker than using GetChildren and checking if the current value in the loop is a player.

0

thanks

This discussion is preserved as it was. New answers, comments, and votes are closed.