Hi Creators,
Last year, we introduced Assistant in beta to help empower your creative process. When we launched, Assistant could answer queries, generate materials, explain code, and insert scripts under Parts and MeshParts. Today, we’re expanding Assistant’s scripting capabilities to generate and insert scripts across your entire Datamodel to help you be more productive. This expansion also presents an opportunity for newer creators or non-scripters, who often struggle with script placement in Explorer, to efficiently complete scripting tasks by interacting with Assistant.
How it works
Assistant intelligently uses a combination of your prompt, conversation history, recently created objects by Assistant and the instance you selected in Explorer to
- Decide where to place the generated script
- The type of the script, namely LocalScript, ModuleScript or Script
- The content of the script
If you have a specific instance to which you want to attach a script, please select it in Explorer; if not, Assistant will determine the insertion location for you.
Once the script is in place, you can click “Play” to test it. If the script does not meet your expectations or needs further refinement, you can open the script and edit it with the help of Code Assist. Alternatively, you can delete the generated script and ask the Assistant to regenerate it based on a revised prompt.
Let’s walk through some examples of what’s now possible with Assistant. We’ll use a tree collection simulation game as an example.
Randomly change a model’s behavior
Let’s say you want to inject a little randomness into your experience. You can now select a Model of a Tree and ask Assistant to “Make a Script to change the color of this tree’s leaves every second”.
Change the color of tree leaves every second
Create and update a leaderboard: tracking points and resetting on player death
You may want to make your game more competitive by adding a leaderboard. Assistant can help.
First, just ask it, "Make a script to set up a leaderboard with Points stats”. Assistant will create a leaderboard and insert it in ServerScriptService.
Next, you’ll want to update the leaderboard when someone collects a tree. You can give Assistant the prompt, “Make a script so that if a player touches this, increase points by 1, and remove the tree”. You can see that it attached a script to the model, which updates the leaderboard.
For added excitement, if you want to make the game a little higher stakes, you can make some trees kill the player. Try asking Assistant, “Make a script to kill the player if they touch this”. Assistant inserts a script into the tree model that sets humanoid.Health to 0 and kills the player.
Lastly, to make it even more challenging, you can set a player’s points to zero when they die. Use the prompt, “Make a script to reset Points stats when a user dies”. Assistant will generate a script and attach it to StarterCharacterScripts that resets the player’s point totals.
A step-by-step demo of creating and updating a leaderboard
Change the scene
If you want to add even more excitement to your game, you can now use Assistant to change the lighting or properties of your environment. Try the prompt, “Make a script to smoothly transition between day/night cycle with a period of 6”.
Assistant will insert a script into ServerScriptService and you can see the scene cycle from day to night.
Note: For demo purposes, the cycleTime in the script was manually changed from 360s to 6s to showcase a day/night transition.
Transition between day/night cycle
Getting started with Assistant
How to Enable Assistant in Studio
Assistant is a beta feature. To enable Assistant:
- Go to File → Beta Features and check the Assistant box.
- Restart Studio
- Click Assistant in the top right corner of Studio
Known Limitations & Issues
- One pass generation & insertion: You can’t tell Assistant to iterate if it responds incorrectly to your prompt. We’re working on enabling iteration by adding Script debugging and modification, targeting the 2nd half of the year.
- Single script insertion: Assistant can only insert one script at a time. Some more complex tasks may require multiple scripts.
- Non-deterministic output: Given your chat history or DataModel hierarchy, it may generate and insert different scripts. You may sometimes need to clear your chat history to get the correct output.
Feedback wanted
Please use the thumbs up and thumbs down buttons when you receive responses from the Assistant. We used that feedback to help us build this capability by identifying which common requests Assistant had trouble fulfilling.
Thank you for making this happen @Genichiroblox, @ToubatB and @swish741! Happy AI scripting!