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

How do I make the ScreenGUI Text follow the time of a intermission/RoundTime?

The problem I've been focusing on was mostly on trying to get this one text follow the intermission/RoundTime.

Here is the code

local countdownval = game.StarterGui.RoundInfo.Frame.Countdown.Num.Value
local countdown = game.StarterGui.RoundInfo.Frame.Countdown.Num
local gameRoundLength = 60
local intermissionLength = 10
local roundStartTime
local Map1 = workspace.MapNormal

local function active()
	local Map1Copy = Map1:clone()
	Map1Copy.Name = "MapClassicCopy"
	Map1Copy.Parent = game.Workspace
	roundStartTime = tick()
end

local function cleanup()
	game.Workspace.MapClassicCopy:Destroy()
end

Map1.Parent = game.ServerStorage
while true do
	active()
	
	repeat
		local currentTime = tick()
		local timeSinceGameStarted = currentTime - roundStartTime
		game.StarterGui.RoundInfo.Frame.Countdown.Num.Value = currentTime
        game.StarterGui.RoundInfo.Frame.Countdown.Text = game.StarterGui.RoundInfo.Frame.Countdown.Num.Value
        wait(0.25)
	until timeSinceGameStarted > gameRoundLength
	cleanup()
	wait(intermissionLength)
end

Here is the ScreenGUI GUI Preview

2 answers

✓ Accepted answer

What I would do is put a IntValue in ReplicatedStorage and change its value to the intermission you want.

Then in the Local Script, I would write something like this:

local label = script.Parent
local intermission = game.ReplicatedStorage.Intermission

intermission.Changed:Connect(function()
	label.Text = tostring(intermission.Value)
end)

In a Server Script that will lower the intermission value I would do something like this:

local intermission = game.ReplicatedStorage.Intermission

repeat
	intermission.Value = intermission.Value - 1
until intermission.Value <= 1

I hope this helps. You could follow the same procedure for the round time.

3 comments

0

This is probably the most popular way. Another way would be to create a RemoteEvent and whenever the intermission time is set you can fire all the clients and have it update from there. However that's a bit harder to do for a beginner like you seem.

0

And where do you want me to put the code of "Server Script" in?

0

It should be in the Main Script that switches maps, teleporting players, etc.

You could use an onchanged function. For example if this intermission/ round time gui uses and object value/ int value to store the countdown number then simply put a script in the text object or that screen gui to change the text as the intermisissions object value does and also display tht value changed to.

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