ReferenceVerse

Loop With Sleep

loop with sleep

Updated
Watch the Knot — loop-with-sleep in ~90 seconds.

Three glowing fireflies blink to life over the cove, one by one, as the island night begins.

A loop with a Sleep command pauses the code without freezing the game, letting you space out actions like spawning props over time.

We start a loop, pause for one second with Sleep, spawn a firefly prop, and break the loop once three are glowing.

Reach for Sleep inside a loop whenever you need to pace out game events or keep long tasks responsive.

firefly_spawner := class(creative_device):
    @editable
    FireflyAsset : creative_prop_asset = DefaultCreativePropAsset
    OnBegin<override>()<suspends>:void =
        var Count : int = 0
        loop:
            Sleep(1.0)
            if (Prop := SpawnProp(FireflyAsset, vector3{X:=0.0, Y:=0.0, Z:=100.0}, rotation{})(0)?):
                set Count += 1
            if (Count >= 3):
                break

Build your own lesson with loop-with-sleep

Generate a personalized, compile-checked lesson grounded in this exact reference.

Build a lesson →