This is a LocalScript and the place is FE!
local remotes = game:GetService("ReplicatedStorage").Remotes
function round(x, dc)
x = x * (10 ^ dc) -- dc is the number of decimal places... cuz math.floor or math.ceil cannot even do so...
x = x + 0.5 - (x + 0.5) % 1
x = x / (10 ^ dc)
return x
end
function FormatTimeText(Number)
local minutes = math.floor(Number/60)
local seconds = round(Number % 60, 1)
return string.format("%d:.1f", minutes, seconds)
end
local prepare = remotes:WaitForChild("Prepare")
prepare.OnClientEvent:Connect(function(mapName, creators, timeLimit)
script.Parent.Text = FormatTimeText(timeLimit)
script.Parent:TweenPosition(UDim2.new(0.375, 0, 0, 0), "In", "Linear", 0.5)
end)
local start = remotes:WaitForChild("GameStart")
start.OnClientEvent:Connect(function(TimeLimit)
local plrGui = script.Parent.Parent.Parent
local antiExplode = false
for i = TimeLimit, 0, -0.1 do -- Problem here, maybe?
if plrGui:FindFirstChild("WinLoseGui") then
antiExplode = true
break
end
script.Parent.Text = FormatTimeText(i)
wait(0.1)
end
if antiExplode == false then
print("Time's up!")
remotes:WaitForChild("TimesUp"):FireServer()
end
end)
local tweenDefault = remotes:WaitForChild("TweenDefault")
tweenDefault.OnClientEvent:Connect(function()
script.Parent:TweenPosition(UDim2.new(0.375, 0, -1, 0), "In", "Linear", 0.5)
script.Parent.Text = "0:00.0"
end)
The function will start when the start event fires (because it is the start of a run/race) I want it so when the time is 0:00.0 then the TimesUp event will fire. However, the event was fired when the timer hits 0:00.1. I don't know how to do it (plus, i think the problem is about the number in the variable i).

1 comment
Ahh! I see. it is always good to know more about the Lua scripting language. Thanks! :)