#Remote event stopping function on a timer

3 messages · Page 1 of 1 (latest)

quick tinsel
#

local textLabel = script.Parent
local remoteEvent = game.ReplicatedStorage:GetChildren("T")

local timer = 0
local running = true

local function stopTimer()
if running then
running = false
print("Timer stopped")
end
end

textLabel.Text = "0.00"
task.wait(3)

while running do
task.wait(0.01)
timer += 0.01
textLabel.Text = string.format(timer)
end

remoteEvent.OnClientEvent:Connect(function()
print("Stopping timer due to RemoteEvent...")
stopTimer()
end)

The script works fine until the stopping part. "T" is a remote event. I don't know why this isn't working. If possible, please fix it.

quick tinsel