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.