Rounds Script Not Working

I am trying to figure out how to get my timer to work when I load in the game, it works perfect when I run the game but it freezes at 0:02 on the client side. This is the only script I have pertaining to the system and it is a server script inside of Workspace. Here is my script so far:

local tiles = TileList:GetChildren()
local Timer = game.StarterGui.ScreenGui.Frame.TextLabel
looptimes = game.Workspace.loopTimes
lasertimes = game.Workspace.laserTimes

local function FireLaser()
	
	local randomTile = tiles[math.random(1, #tiles)]
	print("Tile "..randomTile.Name.." was choosen!")
	
	wait(0.5)
	for i = 1,10,1 do
		wait(0.05)
		randomTile.Transparency = randomTile.Transparency + 0.1
	end
	
	randomTile.CanCollide = false
	wait(2)
	
	for i = 1,10,1 do
		wait(0.05)
		randomTile.Transparency = randomTile.Transparency - 0.1
	end
	
	randomTile.CanCollide = true
	wait(0.5)
	
end

while true do
	local loopTimes = 1
	for i = 1,20,1 do
		print(loopTimes)
		Timer.Visible = true
		if loopTimes > 9 then
			Timer.Text = "0:"..tostring(loopTimes)
		else
			Timer.Text = "0:0"..tostring(loopTimes)
		end

		wait(1)
		loopTimes = loopTimes + 1
	end
		Timer.Visible = false
		
	local laserTimes = 1
	for i = 1,5,1 do
		FireLaser()
		laserTimes = laserTimes + 1
	end
	wait(2)
end```

If anyone could point out where my code is wrong or maybe even give me a possible solution that would be great, thanks for reading my post! PS. This timer has to be and is made to be the same for everyone in the server.
2 Likes

One of your problems here is how your “timer” variable is referencing the starter gui. When a player spawns in, contents of the starter gui container are put into their player gui. You’d have to access the PlayerGui through a local script!

How do I access variables through other scripts, because I would have to get the data, the Timer variable, to/for the server script?

Look into remote events and functions! An alternative could also be having a value on the server and the client checks for value changes

But it isn’t a function or an event, since it is just declaring a variable. Would I just have an event that declares the variable and even then I can’t save it to something or at least not something I am aware of.

Use events to send what the variable is or create a value in replicatedstorage and keep setting the text to that value. Set the values value to the variable