Script Tab

The Script tab contains tools for writing and testing scripts. You can only access this tab when you're viewing or editing a script.

Script tab in the Toolbar

Clipboard

The first section from left contains tools to copy, cut, and paste instances or lines of code.

The Navigate section lets you quickly jump between any open script.

Action Shortcut Description
Back Shift + Ctrl/ + - Navigates to the previous open script.
Fwd Shift + Ctrl/ + = Navigates to the next open script.

Edit

The Edit section lets you search and edit any part of the script, as well as select instances within the Explorer window for bulk actions. See Studio Shortcuts for default shortcuts tied to these actions.

Edit Tools in Script Tab
Action Description
Find

Opens a pop-up menu with the following tools:

  • Find — Locates all instances of your input in the script.
  • Find Next — Locates the next match found in the "Find" widget.
  • Find Previous — Locates the previous match found in the "Find" widget.
  • Find All — Locates all instances of your input within a place, even outside of the currently selected script.
  • Go to Line — Navigates to a specific line within the script.
  • Quick Open — Searches all instances in the Explorer window.
  • Quick Open Actions — Searches all Studio actions.
  • Open Script Function Filter — Searches all functions within the active script and its required module scripts.
Replace Lets you replace one (or all) matches in a script with a new string.
Select

Opens a pop-up menu with the following tools:

  • Select All — Selects all contents of a script.
  • Select Children — Selects all descendants of a selected instance in the Explorer window.

Format

The Format section lets you format sections or the entirety of the script for readability. The dropdown lets you select either Format Selection or Format Document.

Format options in Script tab
Action Shortcut Description
Format Selection Alt/ + Shift + F Formats the currently selected portion of the script with proper layout and indentation.
Format DocumentFormats the entire script regardless of the current selection.

Playtest Options

There are three common options for playtesting an experience. Click the button to start a playtest of that type, or click the small arrow below the button to choose another option.

Playtest options in Script tab
Action Shortcut Description
Play F5 Starts simulating the experience, inserting your avatar at either a SpawnLocation or coordinates of around (0, 100, 0).
Play HereStarts simulating the experience, inserting your avatar in front of the camera's current position.
Run F8 Starts simulating the experience but does not insert your avatar. The simulation begins at the current camera position and you can navigate around using the Studio camera controls.

Once a playtest is running, the following options become available:

Action Shortcut Description
Client / ServerDuring playtesting in a "play solo" mode (Play or Play Here), toggles between client mode and server mode.
Pause / Resume F5 Pauses or resumes the playtest.
Stop Shift+F5 Stops simulation of the experience and resets all objects and instances to how they were before Play, Play Here, or Run was clicked.

Debugging Tools

The Debugger section lets you control the debugger.

Debugging tools in Script tab
Action Shortcut Description
Step Into F11 Moves the debugger into the function on the current line. If there is no function on the current line, the debugger moves to the next line.
Step Over F10 Moves the debugger to the next line of code, not moving into functions.
Step Out Shift + F11 Moves the debugger out of the current function and to the next line of code after the function was initially called. If the current line is not inside a function, the debugger moves to the next line.

In the neighboring Debug Errors section, you can opt to treat script errors as impromptu breakpoints.

Action Description
Never Disables impromptu script debugging.
On All Exceptions Flags all errors, even those occurring within pcall.
On Unhandled Exceptions Only flags errors that occur in unprotected mode; the debugger ignores errors occurring within pcall .

Other Actions

The Actions section at the furthest right contains miscellaneous script actions.

Action Shortcut Description
Go to Script ErrorNavigates the cursor to the first instance of an error within your script.
Reload Script Ctrl/ + R Applies any changes that have been made to a script to the active playtest. The changes are not saved to the script outside of the playtest unless your Studio settings are set to auto-save runtime script changes or you confirm to save the changes upon stopping the playtest. This action is only available while playtesting.
CommitCommits any changes to the script so the updated script is available to other developers within your team. This action is only available during Team Create sessions.
Toggle Comment Ctrl/ + / Toggles whether a line of script is a comment or not.
Expand All Folds Ctrl/ + E Expands all collapsed folds in the script.
Collapse All Folds Shift + Ctrl/ + E Collapses all foldable sections of the script.