Need something faster, than RunService:Heartbeat()

Hello!

I’m currently working on a tower defense game, and while making a targetting system for the units ( server-side ), I came to a conclusion that, for the cooldown, a Heartbeat() loop just… won’t cut it.

From what I’ve noticed, the time between each heartbeat seems to be ~0.016 on the server. I was wondering if there would be a way to make this number lower ( at least half of what it is right now ). I tried researching about custom wait functions but it didn’t really bring me anywhere, as there was none that seemed to fit me.

Any help is appreciated!

local function FWait(Time)
	local Clock = os.clock()
	repeat until os.clock() - Clock > Time
	return os.clock() - Clock
end
-- Usage
local Time = FWait(0.0001)
print(Time) --0.00010019994806498289

Try this function

2 Likes

Works flawlessly, thank you very much!

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.