How to Use Roblox's New AI for Games
Roblox wants anyone to be able to create interactive experiences, and by rolling out two new generative AI features, they're two steps closer to making that a reality.
The first one is called Material Generation and lets you stylize parts with a prompt.
The second one, AI-Powered Code Completion, helps you write and complete scripts.
Getting Started with the Material Generator:
- In Roblox Studio: Go to File > Beta Features > and enable Material Generator.
- Restart Studio, and select Material Generator in the ribbon next to Material Manager.
- Insert or select a part, write a descriptive prompt and click Generate.
You can add a long list of descriptors to help hone in on the material you want. Here are some tips:
- For close up patterns, try using terms like: “close up”, “top down”, and “texture”.
- For simpler repeating patterns, try using terms like “simple”, “pattern”, “symmetrical”, and “flat”.
- For more control, add stylistic terms like “photorealistic”, “cartoon”, “hand-drawn”.
- For the ability to change colors, try terms like “grayscale, " allowing you to tint the material afterwards.
“Bright Red Rock Canyon”
“Brand New Wood Flooring”
“Stained Glass”
“Steampunk Circuit Wall Texture Close Up”
Getting Started with AI-Powered Code Completion
- Insert a sphere part.
2. Right-click on the part and select Insert Object… > Script
3. Paste the following code into the code editor(You need a few lines of code to trigger a suggestion):
local orb = script.Parent
orb.Anchored = true
orb.Color = Color3.new(0.295827, 0.961959, 0.87422)
orb.Name = "orb"
4. Now write a comment like “-- make orb turn red and destroy after 0.3 seconds when player touches it” and make sure to start with “--”.
5. Pause on the line of your comment and wait for Code Assist to generate code.
6. Press ⭾(Tab) to accept and activate the code.
7. Write a new comment below the newly activated code saying “-- create a 3 by 3 grid of orbs around orb” and repeat step 5 & 6.
Testing the Experience:
- Click the Play button.
2. Wait for game to start and locate the orbs on the map.
3. Run into the orbs(using WASD) to see if they turn red and disappears - in that case everything works as intended - and both you and Roblox's AI has done a good job! 🤖
Sources:
Material Generator [Beta]
Code Assist Beta: AI powered code completion