Skip to content

No Async In System

ErrorRoblox
small-rules/no-async-in-system

Disallow yielding Roblox API calls in synchronous Planck system execution.

Rationale

Planck systems run synchronously. If you call a yielding Roblox API from inside a system function, it pauses the entire world update mid-tick. Bad! We do not want this.

This catches any yielding call inside functions typed as PlanckSystem, System, SystemFunction, SystemReturn, or SystemTableLike. Also works for functions returned by system factories and the system property on those types.

The yieldable member list comes from the Roblox API catalog bundled with the plugin. Resolves services from @rbxts/services, game.GetService(), and type annotations.

Diagnostic Messages

noAsyncInSystem
Do not call a yielding Roblox API from a synchronous Planck system.

Configuration

This rule accepts one options object after the severity.

additionalSystemTypeNamesOptional

No description available.

callbackParameterTypesOptional

No description available.

synchronousCallbacksOptional

No description available.

{
"jsPlugins": [
"@pobammer-ts/small-rules"
],
"rules": {
"small-rules/no-async-in-system": [
"error",
{
"additionalSystemTypeNames": [
"value"
],
"callbackParameterTypes": [
{
"callbackArgumentIndex": 0,
"className": "Part",
"imported": "value",
"memberPath": [
"value"
],
"parameterIndex": 0,
"source": "value"
}
],
"synchronousCallbacks": [
{
"callbackArgumentIndexes": [
0
],
"calleePath": [
"value"
]
}
]
}
]
}
}

Examples

async service call in system
import { Players as RobloxPlayers } from "@rbxts/services";
const socialSystem: SystemFunction = () => RobloxPlayers.GetFriendsAsync(userId);
async call in event callback
import { Players } from "@rbxts/services";
const system: SystemFunction = () => {
world.added(PlayerComponent, () => Players.GetFriendsAsync(userId));
};