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

How would I get the TextLabel to sync (Meaning to copy the value of a IntValue) with the IntValue?

I already have this code answered

local Inter = Instance.new("IntValue") -- Creates the Value
Inter.Parent = game.Workspace
Inter.Name = ("Intermission")
Inter.Value = 10

while Inter.Value > 0 do
    wait(1)
    Inter.Value = Inter.Value - 1
end

(Which is this one) - AnsweredCodeForum

1.But my main question is to get the TextLabel to follow what the Value of the IntValue no matter what. (COMPLETE)

Here is the ScreenGUI that has the TextLabel

Image of TextLabel

2.Next thing is how would I repeat the process after a round is over? For example a round lasted for sixty seconds, then the IntValue will countdown to 10 (Which is the Intermission Value). After it counts, it does it again and again.

1 comment

0

There are many better ways of doing this, but if you want you could just set the Inter.Value back to whatever your starting value is.

1 answer

✓ Accepted answer

Was using RemoteEvent should have been using RemoteFunction

This is compatible with FilteringEnabled

In a Script in game.Workspace

IntermissionTime = 10
RoundTime = 60
IntermissionString = "Intermission: %s" -- can be any string, put %s where you want the time to be displayed
RoundString = "Time Left: %s" -- can be any string, put %s where you want the time to be displayed


GetTime = Instance.new("RemoteFunction")
GetTime.Name = "GetTime"
GetTime.Parent = game.Workspace

function GetTime.OnServerInvoke()
	local T = {}
	table.insert(T, String)
	table.insert(T, CurrentTime)
	return T
end

function CountTime()
	while CurrentTime > 0 do
	    wait(1)
	    CurrentTime = CurrentTime -1
	end
end

while wait() do
	String = IntermissionString
	CurrentTime = IntermissionTime
	CountTime()
	String = RoundString
	CurrentTime = RoundTime
	CountTime()
end

In a LocalScript in RoundInfo.Frame

repeat wait() until game.Workspace:FindFirstChild("GetTime")
while wait() do
	T = game.Workspace.GetTime:InvokeServer()
	script.Parent.Countdown.Text = string.format(T[1], T[2])
end

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