Freeze the client for a specific time

If you are curious whether you can freeze the client for a specific time(seconds), here’s the code.

I tried to make something like a delayer that is not dependent on the Task Scheduler and is more precise than task.wait(). Well, it didn’t work by the way as intended, because if the client is frozen it is not counted as a delay.
How is it working?
It overloads the CPU and measures the time that passed if it reaches the mark, it will release

Lua

local function DelayFor(time)
	local current_time = os.clock()
	while os.clock() - current_time < time do	end
end
DelayFor(.01)

TS

function DelayFor(time: number) {
  const current_time = os.clock();
  while (os.clock() - current_time < time) {  }
}
DelayFor(.01);

If you have ever used it, or just have an idea where to use it reply to this post.
Very curious if someone will find the usage of that :face_with_raised_eyebrow:

6 Likes

Well, that’s quite cool actually. But the only thing I can imagine it being useful for is something like a timestop.

3 Likes

What’s the point of doing matrix computations? The frame cannot progress until all threads have yielded; an empty loop would surely accomplish the same effect.

1 Like

Well… i guess its good but you can just use Player.GameplayPaused

1 Like

Ahh, that would be a great one!
The current thread cannot write 'GameplayPaused' (lacking capability NotAccessible)

1 Like

You’re absolutely right. The first thing I thought was to perform a lot of heavy computations to slow down the client.

Computer freeze)
image

2 Likes