Skip to content

Commit 30ac398

Browse files
authored
Remove depreciated globals in task scheduler docs
Removes references of depreciated globals, and replaces references of them to their replacements in the task library.
1 parent ab59a85 commit 30ac398

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

content/en-us/studio/microprofiler/task-scheduler.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ title: Task Scheduler
33
description: Task Scheduler coordinates tasks done in each frame as the experience runs.
44
---
55

6-
The **Task Scheduler** coordinates tasks done each frame as the game runs, even when the game is paused. These tasks include detecting player input, animating characters, updating the physics simulation, and resuming scripts in a `Global.RobloxGlobals.wait()` state.
6+
The **Task Scheduler** coordinates tasks done each frame as the game runs, even when the game is paused. These tasks include detecting player input, animating characters, updating the physics simulation, and resuming scripts in a `Library.task.wait()` state.
77

88
While there may be multiple tasks running, the task scheduler can potentially be overloaded, especially in the following situations:
99

@@ -42,7 +42,7 @@ To build performant games with efficiency in mind, note the following:
4242
Only tasks that must be done after input but before rendering should be done in such a way, like camera movement. For strict control over order, use `Class.RunService:BindToRenderStep()|BindToRenderStep()` instead of `Class.RunService.PreRender|PreRender`.
4343

4444
- **Minimize the amount of waiting scripts.**
45-
Avoid using `while wait() do end` or `while true do wait() end` constructs, since these aren't guaranteed to run exactly every frame or gameplay step. Instead, use an event like `Class.RunService.Heartbeat|Heartbeat`. Similarly, avoid using `Global.RobloxGlobals.spawn()` or `Global.RobloxGlobals.delay()` as they use the same internal mechanics as `Global.RobloxGlobals.wait()`. Uses of `Global.RobloxGlobals.spawn()` are generally better served with `Library.coroutine.wrap()` and `Library.coroutine.resume()` of the `Library.coroutine` library.
45+
Avoid using `while task.wait() do end` or `while true do task.wait() end` constructs, since these aren't guaranteed to run exactly every frame or gameplay step. Instead, use an event like `Class.RunService.Heartbeat|Heartbeat`. Similarly, avoid using `Library.task.spawn()` or `Library.task.delay()` as they use the same internal mechanics as `Library.task.wait()`. Uses of `Global.RobloxGlobals.spawn()` are generally better served with `Library.coroutine.wrap()` and `Library.coroutine.resume()` of the `Library.coroutine` library.
4646

4747
- **Manage physical states carefully.**
4848
`Class.RunService.PreSimulation|PreSimulation` happens **before** physics, while `Class.RunService.PostSimulation|PostSimulation` happens **after** physics. Therefore, gameplay logic that affects the physics state should be done in `Class.RunService.PreSimulation|PreSimulation`, such as setting the `Class.BasePart.Velocity|Velocity` of parts. In contrast, gameplay logic that relies on or reacts to the physics state should be handled in `Class.RunService.PostSimulation|PostSimulation`, such as reading the `Class.BasePart.Position|Position` of parts to detect when they enter defined zones.

0 commit comments

Comments
 (0)