RemoteEvent Throttling

I have a RemoteEvent that gets fired every task.wait(), and that’s OK for me.

Nothing slows down in my game and the event seems to be handling that very well, there’s no throttling or anything.

However, during a playtest with about 5 people, my console was starting to spam warnings of a user apparently spamming the event, even though it was working for everyone.

I tried making the delays 0.05 seconds instead of an empty gap in task.wait(), but it wasn’t fast enough for what I’m dealing with.

I’m not using RunService.RenderStepped because those frames can vary.

If you have any suggestions or solutions, please comment them down below. Thank you.

Heartbeat runs as much as RenderStepped when in comes to FPS unlocking.

image

You can do something like this instead of just using task.wait:

local minWait = 1/60 -- the minimal amount of time that should pass.

local function rwait(delay : number?) : ()
    local passed = 0
    repeat
        passed += RunService.RenderStepped:Wait()
    until passed > (delay or minWait)
end

It will ensure that 1/60 of a second passes before the script continues.

edit: wait, i think i just rewrote how task.wait works… XD
just try task.wait(1/60)

1 Like