Assistant is Roblox's artificial intelligence helper that can help you create and code your experiences. In this chapter, let's walk through how to open Assistant in Studio, write requests that change part behavior, and playtest your results to see if you need to make any changes to the Assistant's code sample.
Open Assistant
Assistant is available in the top-right corner of this webpage, as well as directly in Studio. This second placement allows Assistant to directly reference everything that makes up your experience, then make suggestions on how you can add or edit 3D objects and scripts for your specific gameplay goals.
To open Assistant:
Go to the top-right corner of Studio.
Click on the sparkles icon. Assistant opens underneath the Properties window.
Create prompt
Now that Assistant is open in Studio, it can reference all of your platforms and add scripts to change their behavior, such as:
- Turning a different color every time a player touches the part.
- Moving upward, waiting for 3 seconds, then moving back to its previous position.
- Reducing the player's health the longer they stay on the part.
To demonstrate how this process works, this section of the tutorial shows you how to work with Assistant to make your first platform sparkle whenever a player jumps onto it.
To create a prompt for this behavior:
- OPTIONALRename your first platform so that Assistant knows which part to create a script for.
- In the viewport, select your first platform.
- In the Explorer window, right-click the active object, then select Rename from the contextual menu.
- Type GlitterPart, then press Enter.
In the Assistant window, navigate to the Enter request here input, then type the following: Add a new script that creates yellow sparkles while GlitterPart is touched.
Press Enter. Assistant starts generating a code sample, then a window displays with a suggested code sample that's similar to the following:
local part = script.Parentlocal sparkles = nillocal touchCount = 0local function createSparkles()if not sparkles thensparkles = Instance.new("Sparkles")sparkles.Color = Color3.new(1, 1, 0) -- Yellowsparkles.Parent = partendendlocal function removeSparkles()if sparkles thensparkles:Destroy()sparkles = nilendendpart.Touched:Connect(function(hit)touchCount = touchCount + 1createSparkles()end)part.TouchEnded:Connect(function(hit)touchCount = touchCount - 1if touchCount <= 0 thenremoveSparkles()touchCount = 0endend)Click Accept. As you learn more about coding with Luau, it will be easier to review Assistant's code samples to make sure they work for your use cases.
There is more than one right way to make any particular request, but every word counts. For example, the following chart shows how even slightly different word choices to the original prompt can produce different results.
Request Variationn | Possible Results |
---|---|
Create yellow sparkles while GlitterPart is touched. | Assistant might show you the code, but not make a new script. It might also add the code to a random existing script. |
Make purple sparkles when the part named GlitterPart is stepped on. | Assistant might make sparkles before GlitterPart is stepped on, or make only a few sparkles. |
Make GlitterPart sparkle | Instead of adding a script, Assistant will just add a particle emitter (the object which makes sparkles) to GlitterPart. Which can be good if you want it to sparkle at all times. |
The fewer details you provide, the more unpredictable the results. For example, possible results for the prompt Make parts sparkle when you touch them may include:
- The resultant script not working at all.
- Only a single random part working.
- Parts sparkling before they are touched.
If you make a request and do not get the results you want, rephrase the request and try again.
Playtest results
Although Assistant is constantly learning and getting better, it sometimes produces results that are different than you intended. You must always check the results of its suggestions to make sure they work as intended.
To playtest Assistant's results:
In the top-left corner of Studio, keep the default Test playtest option, then click the Play button. Studio enters playtest mode.
In the experience, jump onto the first platform. If the code sample works correctly, yellow sparkles appear when your character touches the part.
When you're done verifying the results, return to the top-left corner of Studio, then click the Stop button. Studio exits playtest mode.
- OPTIONALReturn to the Assistant window, then press the thumbs up or thumbs down icon to let Assistant know if the code sample worked as you intended.
Now that you know how to code with Assistant, try creating your own prompts to change how parts behave in your obby. When you're happy with your creation, move onto the next section of the tutorial to test and save your work to Roblox.