Script Editor | Documentation - Roblox Creator Hub (2024)

The Script Editor in Studio is the primary tool for scripting on Roblox. It's a self-improving environment that can help you write high-impact code, shorten your development time, and iterate on your experiences. It can improve your scripting experience by:

  • Formatting and highlighting syntax in your code.

  • Offering ways to autocomplete phrases in your code as you type.

  • Helping you navigate code by jumping to variable and function declarations.

  • Helping you find and replace code in open scripts or all scripts.

  • Providing real-time feedback on your code quality and performance.

The Script Editor supports all types of scripts and opens automatically when you create a new script or double-click an existing script in the Explorer window.

You can customize the Script Editor to suit your preferences and workflows, including font family/size, formatting behavior, and colors for syntax highlighting. You can also toggle features such as autocomplete, signature help, and script analysis.

Autocomplete

The Script Editor generates code-related information that can improve your programming efficiency.

  • Autocomplete offers suggestions on how to complete phrases as you type them. Use the and keys to browse the suggestions, then press Tab or Enter to accept a suggestion and insert the complete phrase.

    Script Editor | Documentation - Roblox Creator Hub (1)
  • Autocomplete is tied to the experience's data model. For example, if you have a Model in Workspace called RocketShip, autocomplete suggests RocketShip when you type workspace.roc and indicates that it's a Model.

    Script Editor | Documentation - Roblox Creator Hub (2)
  • Autocomplete offers names for variables and functions that you declare, helping you avoid typos.

    Script Editor | Documentation - Roblox Creator Hub (3)
  • The autocomplete pop-up provides documentation and code samples similar to those on the Engine API Reference, providing you with context on an API's usage.

    Script Editor | Documentation - Roblox Creator Hub (4)
  • When you type an argument into a function, the autocomplete pop-up also shows the function's signature, providing you with a reference for its parameters and return values.

    Script Editor | Documentation - Roblox Creator Hub (5)

Code Navigation

Go to Declaration

You can jump to the declaration of a function or variable by holding Ctrl on Windows or on Mac when clicking the call, or by right-clicking its call and clicking GotoDeclaration.

Script Editor | Documentation - Roblox Creator Hub (6)

Script Function Filter

The Script Function Filter displays a list of all functions declared in a script. To open it, press AltF on Windows or F on Mac. With the list open, you can browse the signatures for each function, filter through them by name, and double-click one to jump to its declaration.

Script Editor | Documentation - Roblox Creator Hub (7)

Find and Replace

The Find/Replace widget lets you find and replace code in an open script. The widget supports matching case, matching the whole word, and searching by regular expressions. To open it, press CtrlF on Windows or F on Mac.

Script Editor | Documentation - Roblox Creator Hub (8)

For broader searches, the Find All / Replace All window lets you find/replace code across multiple scripts in the experience. To open it, press CtrlShiftF on Windows or ShiftF on Mac.

Real-Time Feedback

Script Analysis

The Script Analysis window, accessible from the View tab, performs static analysis on your scripts and displays active errors and warnings. For more information on the errors and warnings, see the Luau linting documentation.

Script Editor | Documentation - Roblox Creator Hub (9)
Script Editor | Documentation - Roblox Creator Hub (10)

Output Window

The Output window, accessible from the View tab, displays errors captured from running scripts, messages from Roblox engine, messages from calls to print(), and errors from calls to warn(). For details on configuring it for your workflow, see Output Window.

Script Editor | Documentation - Roblox Creator Hub (11)

Code Assist

Code Assist is a feature that suggests lines or functions of code as you type, helping you code more efficiently and stay focused. Based on contexts from your comment and code, suggestions will be triggered in two ways:

  • Automatically when you pause on a line for a few seconds and the AI model has enough context for a suggestion.

  • Manually with shortcut Alt on Windows or on Mac (you can customize this shortcut).

Press Tab to accept a suggestion, or ignore it by continuing to type. Currently, your script needs to contain at least a few lines of code to trigger a suggestion.

Code Assist helps automate basic coding tasks so you can focus on creative work, but it does not always suggest perfect code (see Limitations). It's still your responsibility to review, test, and determine if the code suggestion is contextually appropriate.

Improving Suggestions

To get more accurate and relevant suggestions, it's recommended that you follow clean coding practices, regardless of assistance, and:

  • Break down your code into smaller functions.

  • Use descriptive script names that capture the overall intent of what each script does. For example, name a script SyncCustomSounds instead of just Sounds.

  • Assign descriptive names for parameters, functions, and scripts. For example, name a part GreenSphere instead of simply grs, or name a function generateSphere() instead of gen(). Using named functions versus anonymous functions can also produce better hints.

  • Consistently include well-written comments that describe the task you're implementing and what the inputs/outputs should be.

    • Consider including some sample calls with expected results in comments.

    • Suggest how to solve a problem, for instance -- Use raycast.

    • Use the exact function or variable name you defined, for example -- Create 10 greenSphere objects instead of -- Create 10 spheres.

  • If you're a novice scripter, start with basic projects such as "make the player jump when they touch the part" or use the tool to generate small code snippets that you can expand upon as your knowledge grows.

Limitations

The tool helps automate basic coding tasks but it does not always suggest perfect code. Known limitations include:

  • Manual triggering does not always force-generate a suggestion.

  • Suggestions are machine learned from a corpus of code and can thus reflect some limitations of the code they're trained on. For example, suggestions may not use newer APIs in favor of older APIs, or they may use Lua instead of Luau.

  • The tool may generate incorrect or misleading information that is not useful for your purpose.

  • Internal filters attempt to block offensive language, but they're not all-encompassing and there's a possibility the tool may generate offensive or biased information.

  • The suggestions may be the same, similar, or different among users, even with the same prompts. Your code, however, will never be shared with others.

  • The suggestion may be incomplete due to the limited length of output from the learning models.

  • There's a daily cap for the number of suggestions and, once the cap is reached, you will get no suggestions until the next day.

Code Privacy

Currently, Roblox does not use any non-public data to train the learning models. The tool only uses a small subset of free marketplace assets for tuning large language models and the subset has passed various checks for quality and safety filters.

Furthermore, all suggestions are generated by the AI model and do not transfer from one user to another. Since your code is not used for model training, it won't be suggested to other users of CodeAssist, with the one exception of code being posted to free marketplace items.

Multi-Cursor

The Script Editor supports usage of multiple cursors to make edits simultaneously. You can add cursors based on your needs with a mouse click or keyboard shortcut. The initial cursor is called the primary cursor and additional cursors are called secondary cursors.

  • Edits that you make at the primary cursor copy to the secondary cursors. Each edit counts as one action, so undo/redo of an edit applies to all cursors.

  • Widgets such as autocomplete appear on the primary cursor but not the secondary cursors.

  • All of the standard keyboard shortcuts for script editing work with multi-cursor editing, including code indentation, toggling comments, and deleting lines.

The following table summarizes multi-cursor workflows and their shortcuts.

CommandWindowsMac
Add/Remove Cursor at Mouse LocationAlt+ click+ click
Remove Most Recently Added CursorCtrlUU
Add/Modify Cursor on Mouse DragAlt+ drag+ drag
Add Cursor Above/BelowCtrlAlt/ CtrlAlt/
Add Cursor to Next Matching SelectionCtrlDD
Add Cursor to Every Matching SelectionShiftAltLShiftL
Column/Block SelectShiftAlt+ dragShift+ drag
Split Selections Into LinesShiftAltIShiftI

To remove all secondary cursors, exit multi-cursor editing, and return to the primary cursor, press Esc.

Adding Cursors

You can add cursors with a combination of keyboard shortcuts and mouse maneuvers. Cursors merge if they occupy the same space, such as if you add cursors with arrow keys or delete all the characters between cursors.

At Mouse Location

To add a cursor at your mouse pointer location:

  1. Hold Alt on Windows or on Mac.

  2. Click where you want to add the cursor.

With Mouse Drag

You can drag the mouse to add a cursor to a selection, split a multi-line selection into lines, or select columns and blocks of code/whitespace.

To add a cursor to a selection of code through dragging:

  1. Hold Alt on Windows or on Mac.

  2. Click and drag your mouse over the selection of code.

Above and Below Primary Cursor

To add a cursor directly above or below the primary cursor:

  1. Press and hold CtrlAlt on Windows or on Mac.

  2. Press the or arrows.

To Matching Selections

You can add cursors to all matches of a selection or to the next/previous match, and optionally toggle whether matches are case-sensitive and/or match the whole word.

To add a cursor to all matches of a selected portion:

  1. Select the code that you want to search for matches of.

  2. Press ShiftAltL on Windows or ShiftL on Mac.

Removing Cursors

You can remove cursors with the following keyboard shortcuts and mouse maneuvers. Alternatively, you can exit multi-cursor editing by pressing Esc.

At Mouse Location

To remove a cursor:

  1. Press and hold Alt on Windows or on Mac.

  2. Click the cursor you want to remove.

Most Recently Added

To remove the most recently added cursor, press CtrlU on Windows or U on Mac.

Copying and Pasting Cursors

Copying a selection of code includes the cursors within it. The behavior of the paste depends on the number of cursors at the source and the number of cursors at the destination:

  • If the number of cursors are the same, then each copied cursor pastes to each corresponding destination cursor.

  • If the number of cursors are different, then each cursor at the destination receives the entire paste with each copied cursor as a new line.

On-Type Formatting

Pressing enter/return will auto-indent each cursor at the new line relative tothe previous line. If the previous line starts with an incomplete block, the formatter will try to complete it.

Editor Settings

Many customization options are accessible via FileStudio Settings (AltS on Windows; S on Mac).

Script Editor | Documentation - Roblox Creator Hub (12)

Commonly modified options include:

OptionDescription
FontFont face and size for code in the editor.
Tab WidthNumber of spaces representing a Tab indent.
Indent Using SpacesIf enabled, spaces equal to TabWidth are inserted with Tab press.
Text WrappingIf enabled, longer lines of code wrap to the next line.
Script Editor Color PresetColor preset for code elements, selection colors, and more. After choosing a preset, you can set specific colors for options like Selection Color and Comment Color.

Keyboard Shortcuts

The Script Editor has the following keyboard shortcuts. You can also access many commands from the Script tab which appears in the Studio toolbar whenever you're viewing or editing a script.

CommandWindowsMac
Close ScriptCtrlWW
Reopen Last Closed ScriptCtrlShiftTShiftT
Quick OpenCtrlPP
Show Script in ExplorerCtrlAltKK
Zoom InCtrl==
Zoom OutCtrl--
Reset Script ZoomCtrl00
Script Editor | Documentation - Roblox Creator Hub (2024)

FAQs

Is Roblox scripting hard? ›

Roblox uses Lua and learning the basics of Lua can take anything from a few days to a few weeks, depending on the time you put into it. The more you practice, the faster you will learn. To get started and to become effective in Lua programming, there are some basics you should learn and know.

Does Roblox use C++? ›

Roblox games and the Roblox platform itself are primarily built and scripted using Lua and C++.

How long does it take to master Roblox scripting? ›

Roblox employs Lua, and learning the fundamentals of Lua can take anywhere from a few days to a few weeks, depending on how much time you devote to it. The more you practice, the more quickly you will learn.

What is the best admin script in Roblox? ›

If you have enough experience, I'd advise you to make your own admin. As it's your code, it'd be easier for you to understand and change in an easier manner. However, if you have no experience, I definitely advise using Kohl's or HD Admin.

Can u get banned for scripting in Roblox? ›

Creating scripts for Roblox can be risky, especially if they involve exploiting or modifying game mechanics in unauthorized ways. Using or distributing scripts that give players unfair advantages or manipulate the game in ways that violate Roblox's Terms of Service can result in account bans or other penalties.

Can Roblox scripts hack you? ›

Hackers/Exploiters can't modify your scripts or call functions physically unless there is some vulnerability, Client-Sided scripts are more exploitable, but Server-Scripts are fine as long as there is no Remote contact between scripts that can allow backdoor entrances in your game.

Is Lua easier than Python? ›

Kids who have studied both languages with FunTech tend to say that Lua is easier to learn than Python. However, as with any type of coding, it's down to opinion and experience.

What is the very first Roblox game to reach 1B+ visits? ›

MeepCity was the first game on Roblox to pass 1 billion total visits.

Is Lua hard to learn? ›

Is Lua hard to learn? Luckily, if you want to learn Lua, you'll be happy to hear that Lua is not hard to learn. The best way to learn Lua, or any other programming language, is to do some programming. You can do this by building small programs or even start making a game and learn the basics as you go.

How much does a Roblox scripter get paid? ›

As a veteran advanced scripter I usually take 100-1000 or anything like that (dollars) for a percent game or 10-100 dollars a commission (depending on the work) Usually newbie scripters would take like 5-40 dollars for a commission or something more so maybe try that. You could also negotiate with them.

How many scripts can Roblox handle? ›

There is no limit to how many scripts you can have, but how you handle these scripts.

How much script activity is bad Roblox? ›

The best thing to look at is user reports and playtesting. Roblox could do a lot better about telling you how your game's performance measures up. That being said, I've also read that anything above 3% activity is considered bad and that you shouldn't really worry about the rate.

How much does Roblox pay admin? ›

As of Aug 27, 2024, the average hourly pay for a Roblox Admin in the United States is $21.04 an hour.

Who made Adonis admin Roblox? ›

Adonis is an admin system made by Epix Incorporated.

Can I be admin in Roblox? ›

Administrator badges are given out to people who work for Roblox to make them easily identifiable to the community. Administrators and Moderators are all adults over the age of 18 who work at Roblox as a paying job.

Is scripting harder than coding? ›

Scripting languages are often simpler than standard programming languages, which makes them less difficult for novices to learn. Scripts are often brief and use simple syntax, and they frequently conceal features such as data storage and memory usage from the end-user.

How difficult is scripting? ›

Learning a scripting language is an excellent introduction to coding and programming. They are relatively easy to learn and can be an effective jumping-off point to pursue your hobbies or career interests further.

Is coding a Roblox game hard? ›

After reading this blog, you must understand that creating a Roblox game is easy. To make a Roblox game, you can be tech-savvy. Roblox Studio includes a pre-uploaded template with all the key mechanics and assets already in place for each game genre.

Is it OK to use scripts in Roblox? ›

It is dangerous and can put your account and your computer at risk. it can simulate an exploiter environment.

Top Articles
3 Victims Killed in Michigan State University Shooting Identified
Majors, degrees and programs | Michigan State University
Gaseous Form Pathfinder
Wsbtv Fish And Game Report
Capital In The Caribbean Nyt
Four Brothers 123Movies
Swgoh Darth Vader Mods
Growing At 495%, Saviynt Says It Prevails Over SailPoint In $20B Market
Equinox 63Rd Street Class Schedule Pdf
Boston Terrier Puppies For Sale Without Papers
Pogo Express Recharge
Sigma Aldrich Calculator
Rent A Center Entertainment Center
Ju Hua (Flos Chrysanthemi): Uses, Benefits, Side Effects, Warnings
Die 12 besten Chrome Video Downloader im Überblick
Dallascowgirl Leaked Of
Walmart Listings Near Me
When His Eyes Opened Chapter 2981
Itawamba Ixl
Mhgu Bealite Ore
Cato's Dozen Crossword
German American Bank Owenton Ky
Aston Carter hiring HR Specialist in Inwood, WV | LinkedIn
What’s Closing at Disney World? A Complete Guide
Wild Fork Foods Login
Redgifs.comn
Weather In Allentown-Bethlehem-Easton Metropolitan Area 10 Days
Palladium-Item from Richmond, Indiana
Usc Human Biology
Goodwill Winter Springs 434
Greet In Cheshire Crossword Clue
T-Zell-Leukämie mit großen granulären Lymphozyten - Altmeyers Enzyklopädie - Fachbereich Innere Medizin
Lids Locker Room Vacaville Photos
Lil Coffea Shop 6Th Ave Photos
Ms Eppi Login
Antonio Brown Football Reference
Publix – Supermarkt mit ökologischem Gewissen und exzellentem Service
Pick N Pull Near Me [Locator Map + Guide + FAQ]
My Compeat Workforce
Family Link from Google - Family Safety & Parental Control Tools
Depths Charm Calamity
Road Techs
Chuck Wagon Café, le restaurant de l'hôtel Cheyenne à Disneyland Paris : prix et infos
Tyson Foods W2 Online
Lewisburg Tn Jail Mugshots
Promiseb Discontinued
Craigslist Antelope Valley General For Sale
What Does Wmt Contactless Mean
Fraction Button On Ti-84 Plus Ce
Live TV | Halifax | CBC Gem
Siswa SMA Rundung Bocah SD di Bekasi, Berawal dari Main Sepak Bola Bersama
Black Adam Showtimes Near Grand 18 - Winston-Salem
Latest Posts
Article information

Author: Terrell Hackett

Last Updated:

Views: 5943

Rating: 4.1 / 5 (72 voted)

Reviews: 87% of readers found this page helpful

Author information

Name: Terrell Hackett

Birthday: 1992-03-17

Address: Suite 453 459 Gibson Squares, East Adriane, AK 71925-5692

Phone: +21811810803470

Job: Chief Representative

Hobby: Board games, Rock climbing, Ghost hunting, Origami, Kabaddi, Mushroom hunting, Gaming

Introduction: My name is Terrell Hackett, I am a gleaming, brainy, courageous, helpful, healthy, cooperative, graceful person who loves writing and wants to share my knowledge and understanding with you.