Changing Surface Gui Text

Hi! I am try to make a training course for my game and it needs a count down timer. I have a surface gui and I am using a script to change its text but it isn’t doing anything.

local head = script.Parent.Head
local Time = script.Parent.Value
local negCorner = game.Workspace.NegXNegZTrain.Position
local posCorner = game.Workspace.PosXPosZTrain.Position
local ground = game.Workspace.CenterTrain.Position
local StartingTimer = script.Parent.TimeStart.SurfaceGui.TextLabel.Text
local RoundTimer = script.Parent.TIME.SurfaceGui.TextLabel.Text
function Yes()
	for i = 15, 0, -1 do
		StartingTimer = ("Training Round starts in..." .. i)
	for i, player in ipairs(game.Players:GetPlayers()) do
		if player.TouchedStart.Value == true then
			local teleLoc = + 10, posCorner.X - 10), ground.Y + 100, math.random(negCorner.Z + 10, posCorner.Z - 10))
			player.Character.HumanoidRootPart.CFrame = teleLoc

What am I doing wrong? The code seems correct, and there are no errors…

The problem is you are saving the actual value of the TextLabel, you would just remove the .Text at the end of the variable, and add it when you’re setting the text.

local StartingTimer = script.Parent.TimeStart.SurfaceGui.TextLabel
StartingTimer.Text = ("Training Round starts in..." .. i)
1 Like

Yes it worked! Many thanks to you.

1 Like