<!-- Page: https://rustic-game-engine.pages.dev/docs/scripting/lua/attach-and-choose-a-scope -->

# Attach and choose a scope

[Back to Lua 5.4](https://rustic-game-engine.pages.dev/markdown/scripting/lua.md).

- **Global Startup Script**: one game-lifetime instance, started when Play starts.
- **Scene Startup Script**: one scene-lifetime instance, started after globals when
  its `scene/{name}.scene` loads.
- **Object Component Script**: one instance per attachment, created and removed with
  its object. Select the object and use **+ Add Component**, or drag the script from
  Explorer onto the viewport.

Moving or renaming the `.lua` file in the editor is safe because the attachment holds
its persistent Asset ID. Do not edit `config/scripts.ron`.
