Waiting amount of frames before continuing

Hello! Simple question though I haven’t been able to find anything about this anywhere. Is there a way to wait a amount of frames on the server before continuing? For example:

print("Hello")
<Wait 10 Frames>
print("World!")
1 Like

Oh, that is simple

local AmountOfFrames = 10
local RunService = game:GetService("RunService")

for _=1, AmountOfFrames do
RunService.Heartbeat:Wait() -- task.wait() works too
end

if you need a explanation of each thing just ask me

Btw why do you need this function? do you need to wait for something?

2 Likes

Thanks for replying, I’ll be modularizing this.

To answer your question about what I’m using this for. My games combat system will be running on a frame system. In simpler terms when a move started it will wait a certain amount of frames, active for amount of frames, and then have a ending lag in amount of frames.

If it is a “anti-lag” that sounds smart, but good luck with your project.

It’s not really “anti-lag” but to keep systems organized and easy to tweak for balancing.