The script works great, but C:Disconnect has this annoying error that bothers me and I dont know how to fix it. I tried changing the type, making the variable global, directly connect the variable to the function ect. But theres always some sort of type error no matter what.
--!strict
local UIModule = {}
local RunService: RunService = game:GetService("RunService")
function UIModule:UpdateTimer(Endtime: number)
local Players = game:GetService("Players")
local Player = Players.LocalPlayer
if not Player then return end
local TimerUI: TextLabel = Player.PlayerGui.RoundUI.Timer
local C: RBXScriptConnection
C = RunService.RenderStepped:Connect(function()
local CurrentTime: number = os.clock()
local TimeLeft: number = Endtime - CurrentTime
if TimeLeft <= 0 then
TimerUI.Text = "0.00"
C:Disconnect()
else
TimerUI.Text = string.format("%.2f", TimeLeft)
end
end)
end
return UIModule
