InitScript

Bring a scene to life when you press Play. Move things every frame, make new instances, or drive a whole video from code.

A low granite plinth on a paved patio before a sunlit cream plaster wall, blue sky above, mid afternoon sun from the front left; eight pine boards lie in a straight stack in the middle of the plinth.
Before
The same frame with an InitScript, so the stack of boards winds up into a spiral stair.
After

After: An InitScript whose loop turns each board 40 degrees more than the one below and moves it out half a stud.

An InitScript runs in Play mode (F5) and in renders, never in Edit. Connect to Root.Heartbeat to run every frame; Stop disconnects everything and puts back what it changed. Directly under a CookVideo it may return function(time). The video calls it once per frame with its time, in Play, renders and exports, so it must depend on time alone, and it draws the video's picture layers itself.

From ModuleScript 1
From LuaSourceContainer 1
From Instance 22