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 indicated in Studio 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.

ActionShortcutDescription
BackShiftCtrl- (Windows)
Shift- (Mac)
Navigates to the previous open script.
FwdShiftCtrl= (Windows)
Shift= (Mac)
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 indicated in Script tab
ActionDescription
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.
ReplaceLets 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 indicated in Script tab
ActionShortcutDescription
Format SelectionAltShiftF (Windows)
ShiftF (Mac)
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
ActionShortcutDescription
PlayF5Starts 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.
RunF8Starts 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:

ActionShortcutDescription
Client / ServerDuring playtesting in a "play solo" mode (Play or Play Here), toggles between client mode and server mode.
Pause / ResumeF5Pauses or resumes the playtest.
StopShiftF5Stops 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 indicated in Script tab
ActionShortcutDescription
Step IntoF11Moves 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 OverF10Moves the debugger to the next line of code, not moving into functions.
Step OutShiftF11Moves 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.

ActionDescription
NeverDisables impromptu script debugging.
On All ExceptionsFlags all errors, even those occurring within pcall.
On Unhandled ExceptionsOnly 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.

ActionShortcutDescription
Go to Script ErrorNavigates the cursor to the first instance of an error within your script.
Reload ScriptCtrlR (Windows)
R (Mac)
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 CommentCtrl/ (Windows)
/ (Mac)
Toggles whether a line of script is a comment or not.
Expand All FoldsCtrlE (Windows)
E (Mac)
Expands all collapsed folds in the script.
Collapse All FoldsShiftCtrlE (Windows)
ShiftE (Mac)
Collapses all foldable sections of the script.