Code Assist Beta: AI powered code completion

Hi Creators,

Code Assist is now in beta release! We want to express our sincere gratitude for your feedback and are committed to iterating and building a better product for you!

Our goal is to help you code smarter and faster, harnessing your full potential and maximizing your time and impact. It’s currently designed for experienced scripters but will eventually be made more accessible to aspiring scripters as the model improves.

How it works

Code Assist is an AI assistant in Studio Script Editor 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, AI suggestions will be triggered in two ways:

  1. Automatically when you pause on a line for a few seconds or when the AI model gets enough context for a suggestion.

  2. Manually with hotkey (this can be customized through File > Advanced > Customize Shortcuts).

  • Alt + \ (Windows)
  • + \ (MacOS)

Currently, you need to have a few lines of code to trigger a suggestion.
To accept the suggestion, press Tab , and then you can edit just as editing your own code. To ignore it, keep typing.

CodeDemo

Example of how Code Assist works

To enable the beta in Studio, go to File > Beta Features, enable AI-Powered Code Completion, then accept the legal disclaimer. If you decide to opt out, simply uncheck the feature. You can opt in and out any time during the beta period.

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

To get more accurate and relevant suggestions, we recommend you follow good coding practices regardless of AI assistance:

  • Break down your code into smaller functions.
  • Assign descriptive names for parameters, functions, and scripts.
  • Consistently include well-written comments throughout your coding process.

Also, you can work on natural language hints to get better results (see FAQ for more information).

What’s next

We will continue to improve the model and user experience based on your feedback and needs. So, opt in to the beta and give it a try. We can’t wait to hear your thoughts and continue to improve our product.

Huge thanks to the team who made this happen: @Genichiroblox, @Regal_Corgi, @IcyTides, @ignotuscaligo, @MetalMax2, @swish741, @cthulwho, @lyocean, @iriszh, @windy0724, @MoonRocketApollo, @AndroidYouth, and many others for all their hard work on this feature.

FAQ

1. What data does Roblox use for AI model training purposes?
  • Currently, we do not use any non-public data to train the models. The tool only uses a small subset of free marketplace assets for fine tuning large language models. The subset has passed various checks for quality and safety filters. If we plan to make changes to the model training approach, we will engage in open and transparent communication with our community.
2. Will my code be shared with other creators as suggestions?
  • No. All suggestions are generated by the AI model, instead of transferring from one user to another. Since your code is not used for model training, it won’t be suggested to other users of Code Assist, with the one exception of code being posted to free marketplace items.
3. Will Code Assist replace scripters on the Roblox Platform?
  • Code Assist is here to augment your programming skills, not replace them. It is positioned as a ‘sidekick’ that makes your coding tasks easy, while still leaving you in the driver’s seat. It can never match the creativity, domain knowledge, and problem-solving skills of an experienced developer. Also, like other AI powered tools, its suggestions have limitations (see details in question 6). Only you, the creator, can work on the creative part of your Roblox experiences, and use your judgment to review, refine, and vet the suggestions from AI.
4. As a non-scripter or new scripter, can I rely on Code Assist to create code for my experiences?
  • Code Assist is primarily designed to assist Roblox scripters in writing code more efficiently. Due to the limitations of the model, it still requires scripters to review and modify the code suggestions. Larger suggestions in particular have lower accuracy. Therefore, we expect that a typical workflow will be scripter writing code > Code Assist suggests > scripter accepts, iterates, and keeps writing.

    For novice scripters, you are absolutely encouraged to use Code Assist. We would recommend starting with small projects such as “make the player jump when they touch the part”, or using it to generate code snippets that you can use as a starting point. You can also use it to help you learn more about programming concepts and syntax. However, it’s important to keep in mind that AI is not a substitute for learning and practicing scripting skills.

    Meanwhile, we are exploring new ways to make scripting easier for aspiring scripters. Stay tuned.

5. How can I get better suggestions from the model?

Adding context with natural language hints can greatly improve the quality of predictions produced by the model.

  • Context: it works best in the context of a codebase rather than in an empty Script in an empty Place. Adding a few lines of code, such as defining a few variables before your prompt can improve the accuracy of its suggestions.
    [Note] Currently, it only suggests when you have several lines of code in the script.

  • Comments: Write descriptive comments describing the problem you are solving and what the inputs and outputs should be.

    • You can also include some sample calls with expected results in comments to improve hints.
    • You can suggest how to solve a problem (e.g. “use raycast”)
    • Using the exact function or variable name as you defined also helps improve suggestion quality
  • Identifier naming: Pick descriptive names for identifiers such as functions and variables. Naming functions instead of anonymous functions can also signal better hints.

  • Script names: Pick a descriptive script name that captures the intent of what you are trying to do.

  • Casing: Appropriate use of case and delimiters and case (such as camelCase, CamelCase, or snake_case) coupled with good identifiers naming can provide the model with more hints.

6. What is the limitation of Code Assist?
  • Our suggestions are learned from a corpus of code, and can thus reflect some limitations of the code they are trained on. For example:

    • Not using a newer API
    • Using Lua instead of Luau
  • The tool may generate incorrect, misleading, or other information that is not useful for your purposes.

  • We have included filters to block offensive language, but they are not all-encompassing. There is a probability the tool may generate offensive or biased information. We will continue to improve the filter system to help our AI learn.

  • 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 models.

  • There is a daily cap for the number of AI suggestions. You will get no suggestions once the cap is reached until the next day.

  • Not all manual triggering generates suggestions.

7. Who is responsible for the code suggested by Code Assist?
  • You are responsible for the code you write with Code Assist’s help. Roblox makes no warranty about content or information through or from the tool. We recommend that you review, test, and vet the suggestions before putting it into your experiences.

Happy coding!

295 Likes

This topic was automatically opened after 10 minutes.

It looks promising, I tested this a few days back but i found out that the suggestions wont work within a scope, is this currently fixed?
If they do work, most of the times it just spams different events or functions i’ve never asked for.

27 Likes

As @BobbieTrooper said, this looks extremely promising, but sometimes, it takes an extremely long time for AI to generate responses, and 45% of the time, it just spams the same line. (Or creates something that doesn’t fit the intended prompt) I definitely assume there are going to be improvements, as it is a beta, but right now, it’s mostly unusable. I’m definitely not disappointed because I didn’t expect anything in the first place, just kind of hoping it gets improved. Thanks hotkey too, very helpful.

Any plans to expand the dataset of the AI?

19 Likes

I’m still not very crazy over it. It’s buggy, and generally not helpful. Over the past few days, I’ve been finding even more bugs with it:

https://devforum.roblox.com/t/ai-code-assist-material-generator-is-here-thoughts/2220430/159?u=darkpixlz



image
just to name a few of my experiences with it so far

66 Likes

In my opinion, this is a rather interesting update that allows for better learning of the Lua programming language. I’m very curious to see how it will improve and what its potential will be in the future.

13 Likes

Please add an option to disable the automatic suggestions when waiting on a line.

47 Likes

It seems to me that Code Assist is good if you give it clear requests. It’s worse when you ask it non-standard questions, or, in other words, questions that are unclear or difficult to implement.
Of course, it is still in beta testing, so there are still many flaws.

5 Likes

From the few days of testing I can clearly say that it only works if you know how to code, meaning that for beginners, this isn’t going to help… Much, at least.

As mentioned on this post, albeit recommending it to new scripters, it’s of no use because the code that the AI generates is not perfect. Additionally, the AI only writes based on what exists, so if you’re not careful, it’ll write on its own mistakes. This meaning, if you don’t have a clear knowledge of the language, what use will a new scripter give to it? They’ll expect it to be perfect, or simply won’t see mistakes.

Another problem is that the AI is extremely slow, at least compared to Copilot. For a single line of code, Copilot suggested it in <0.7 seconds, while Generative took around 3 for the same result. Is this the cooldown between line pause and suggestions, or does it take time to compute solutions?

Since GenerativeAI uses free model code, the outcome is also generally not the best. It cannot typecheck, uses deprecated globals (not looking at wait), and suggests beyond what we can call “good” code. The current version is plagued with bugs and does not promote using more performant and recommended functions (like task). It does, but not out of the box, so another no-no for what you want to achieve as a solution for beginners.

It’s a beta version, yes, it is unstable and has its issues. However, this AI really needs to be trained using a larger data collection. Free model code, as everyone knows, is not the best in the world. Say what you want, though.

Honestly speaking, you can simply enable a feature in your games that allow data (script) collection for the AI to train on. Much better than using free models. At least then we know our data is being sold.

12 Likes

Wow, I’m impressed. Reminds me of Github copilot.

Now I do wonder, does it adapt to my coding style?
Does it suggest variables, functions and whatnot similar to how I would write them?
Does it know optimization techniques?

I do a lot of manual writing and optimizations and I have a bit of an unusual coding style.
I use metatables to make classes and make modular systems, is it aware of other module scripts and whatnot?

Importantly, CAN I train it on my own code to improve it and make it adapt better?

11 Likes

I have a very very important question:
Did you send us the Alpha?
Because if this is Beta I understand why this will not replace Programmers, it’s too dumb to been create a while loop withh Hy out crashing the Game

6 Likes

Even if a stable version is released, it won’t replace scripters dude. You would take more time trying to get the AI to write the thing out than actually doing it yourself.

8 Likes

It clearly says it is in Beta release. :skull:

3 Likes

And what is the daily cap? Is there an exact number orrr?

5 Likes

Regarding FAQ item #1, please work on the safety filter. Otherwise, good job.

1 Like

It’s definitely buggy, but I am excited to see if it becomes comparable with Copilot, GhostWriter, or ChatGPT!

I have come across a few errors and it doesn’t always seem to generate prompts when I ask it to.

If I start writing something and I need to tab it will auto do it for me which is quite frustrating.

6 Likes

To ensure a high-quality experience and manage our total cost of providing Cost Assist to all creators, we are experimenting with a daily cap. It’s subject to changes. As of today, it’s primarily set around 100-200.

15 Likes

I haven’t read the full topic, and I haven’t read many of the replies. But, Currently, roblox is not using any private data to train this AI. This is fine. But when you say currently, are you implying that this is the current state, and in the future, roblox might use non public data to train this AI? Or does roblox not plan on using any private data to train the AI at all? Do you know what the plans on this are? And if roblox ever starts using private data to train the AI, will there be a way to add some type of attribute to the private data to tell roblox not to use this data to train the AI (for personal / privacy reasons, assuming that this private data comes from roblox games)? What if we have some type of secret key used to access some information, that can be detrimental to our game if someone other than ourselves know what the secret key is?

6 Likes

This is pretty cool when it has enough context to work with, I requested when the beta first enabled a few days ago that we could give the AI our own specialised training info.

The ability for it to seek through requires and DOM-aware is probably the killer feature for this. It would be nice if the AI was trained to not use deprecated methods unless there isn’t a suitable difference, for example, wait()s should be converted to task.wait() before spitting it out

Can we also have a toggle to turn it off like you can with Copilot

6 Likes

Maybe it will work like the “noai” tags; so people that don’t want their stuff to be used in/for AI training can choose to easily opt out.

I hope that they allow people to choose whether to opt-in (being opted out by default) and not be forced into a dataset.

1 Like