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

Help at Scripting a GUI?

Hi, I am making a Countdown GUI, for this, a script at game.Workspace changes the LocalPlayer GUI, but I want to change all the players GUI, what function I need to use?

Script:

local time = 60
for i = 1, 60 do
game.Workspace.Round.Disabled = true
wait(1)
time = time - 1
game.Players.LocalPlayer.PlayerGui.Countdown.Frame.Hint.Text = 'Finishing up last round...'
game.Players.LocalPlayer.PlayerGui.Countdown.Frame.Number.Text = tostring('00:'.. time)
if time <= 30 then
game.Players.LocalPlayer.PlayerGui.Countdown.Frame.Hint.Text = 'Cleaning...'
game.Players.LocalPlayer.PlayerGui.Countdown.Frame.Number.Text = tostring('00:'.. time)
end
if time <= 15 then
game.Players.LocalPlayer.PlayerGui.Countdown.Frame.Hint.Text = 'Waiting...'
game.Players.LocalPlayer.PlayerGui.Countdown.Frame.Number.Text = tostring('00:'.. time)
end
if time < 10 then
game.Players.LocalPlayer.PlayerGui.Countdown.Frame.Number.Text = tostring('00:0'.. time)
end
if time <= 0 then
game.Players.LocalPlayer.PlayerGui.Countdown.Frame.Hint.Text = 'Starting game...'
wait(2)
game.Workspace.Round.Disabled = false
end	
end

1 answer

This worked for me:

local time = 60
for i = 1, 60 do
	game.Workspace.Round.Disabled = true
	wait(1)
	time = time - 1
	coroutine.wrap(function() -- I don't know if this is actually necessary, but better safe than sorry.
		for _, v in pairs (game.Players:GetPlayers()) do -- Loops through the players and changes the GUI.
			if time > 30 then
				v.PlayerGui.Countdown.Frame.Hint.Text = 'Finishing up last round...'
				v.PlayerGui.Countdown.Frame.Number.Text = tostring('00:'.. time)
			end
			if time <= 30 then
				v.PlayerGui.Countdown.Frame.Hint.Text = 'Cleaning...'
				v.PlayerGui.Countdown.Frame.Number.Text = tostring('00:'.. time)
			end
			if time <= 15 then
				v.PlayerGui.Countdown.Frame.Hint.Text = 'Waiting...'
				v.PlayerGui.Countdown.Frame.Number.Text = tostring('00:'.. time)
			end
			if time < 10 then
				v.PlayerGui.Countdown.Frame.Number.Text = tostring('00:0'.. time)
			end
			if time <= 0 then
				v.PlayerGui.Countdown.Frame.Hint.Text = 'Starting game...'
				wait(2)
				game.Workspace.Round.Disabled = false
			end 
		end
	end)()
end

1 comment

0

:O thanks man!!! I will give credit :D

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