this probably doesn’t make a difference in the matter but im just wondering what would better to use for accuracy and performance
its basically a second counter clock
let me show you what i mean
this with heartbeat step
local RunService = game:GetService("RunService")
local total_time = 0
local loop = RunService.Heartbeat:Connect(function(step)
total_time += step
if math.floor(total_time) < total_time - step then return end
print(math.floor(total_time))
end)
with time()
local RunService = game:GetService("RunService")
local debounce = 0
local total_time = 0
local loop = RunService.Heartbeat:Connect(function()
if time() < debounce + 1 then return end --if current time is greater than debounce + 1 second
debounce = time()
total_time += 1
print(total_time)
end)
here’s heartbeat
https://developer.roblox.com/en-us/api-reference/event/RunService/Heartbeat