---
title: Introduction to scripts in Unity Spark
product: Unity Spark
canonical: https://docs.unity.com/en-us/unity-spark/create/build/scripts/about-scripts
last_updated: 2026-12-01
generated_at: 2026-12-01T21:01:53.459Z
locale: en-us
---

# Introduction to scripts in Unity Spark

> Understand how Unity Spark scripts work, how they differ from Unity Editor scripts, and what they can do.

Scripts control your game's behavior, such as how the player moves, what happens when they collect a coin, or what a button does. Unity Spark scripts use Luau and attach to objects as [components](/unity-spark/create/build/components/about-components.md).

You don't need to use scripts to make a game, you can ask the [AI assistant](/unity-spark/create/assistant/about-assistant.md) to create gameplay logic for you. However, if you want to write your own scripts, this section explains how they work and what they can do.

## Differences from Unity Editor scripts

Unity Spark writes gameplay logic in Luau, a typed dialect of Lua, as Unity Studio scripts. Scripts work differently from scripts in the Unity Editor:

* Scripts attach to objects as components.
* Scripts aren't C#, and you don't need to compile them. They run as soon as you enter Play mode.
* Scripts use the Unity Spark scripting API, which works with the objects and components that Unity Spark provides. It doesn't expose the full Unity Engine API.

For more information, refer to [Unity Spark fundamentals](/unity-spark/intro/concepts.md) and [Limitations of Unity Spark](/unity-spark/intro/limitations.md).

## Examples of script code

Other pages include the following examples of Unity Spark script code.

| **Task**                  | **Code**                            | **More information**                              |
| ------------------------- | ----------------------------------- | ------------------------------------------------- |
| Load another scene        | `SceneManager.LoadScene("Level 2")` | [Scenes](/unity-spark/create/build/scenes.md)     |
| Respond to a button click | `button:OnClick(startGame)`         | [Game UI](/unity-spark/create/build/ui-editor.md) |

Scripts can also find objects by their tag, move objects whose **Rigidbody2D** component uses the **Kinematic** body type, and change **Scene Settings** while the game runs, for example, to darken the sky as night falls.

## Additional resources

* [Script window reference](/unity-spark/create/build/scripts/script-window-reference.md)
* [Write and attach scripts](/unity-spark/create/build/scripts/write-scripts.md)
* [Unity Spark fundamentals](/unity-spark/intro/concepts.md)
* [Limitations of Unity Spark](/unity-spark/intro/limitations.md)
