Skip to content

Latest commit

 

History

History
248 lines (155 loc) · 10.6 KB

prompt-engineering.md

File metadata and controls

248 lines (155 loc) · 10.6 KB
title description
Assistant prompt guide and examples
Get tips and tricks on how best to prompt Roblox's AI Assistant to get the best results.
[Share your prompts and experiences](https://devforum.roblox.com/t/check-out-the-generative-ai-stream-and-let-us-know-your-best-prompts/3215844) in the Roblox forum so that we can make Assistant better!

This document gives guidance on prompting Assistant and provides examples and inspiration on what Assistant can do.

Be specific

If Assistant fails, add more details to your prompt and try again. Use instance names exactly as they're spelled, specify which function you want Assistant to use, and tell Assistant which type it's working with, such as a part or a model.

**Not specific** **More specific**
Place the trees in a circle. Place 10 copies of the "pine_tree" model in ReplicatedStorage in a 30 stud radius circle around the SpawnLocation.
Make the part move. Add a script to make "my_part" move up and down 10 studs repeatedly using TweenService.
How can I design a core loop? Help me design a fun core loop for my game. I want to build a game where players can hunt treasure as pirates. They can also buy and upgrade pirate ships and battle each other.

Use your selection

Selection is a great way of specifying an object or set of objects you want to refer to in your prompt. Select multiple objects and ask Assistant to modify them, make duplicates and place them somewhere, or continue a position pattern like maintaining placement in a line.

Edit time and run time

Assistant sometimes confuses the difference between edit time and run time. If you ask Assistant to take an action, it will likely bias towards doing it at edit time. If you want the action to happen during run time, ask Assistant to insert a script that takes the action. For example, tell Assistant "add a script to make the time of day 8:00 AM" instead of "make the time of day 8:00 AM."

Keep trying

Don't get discouraged if Assistant doesn't work exactly the way you want the first time. Often, making small tweaks and trying again can lead to better results. Many AI tools are non-deterministic, meaning they don't create the exact same output each time you ask them to do something. There's some variance, which you can tap into and control using tweaks to your prompt.

AI in its current state requires work. It takes time to understand how to best speak to Assistant, what it can do, and how to get what you want out of it.

Multi-step prompts

Consider using multi-step prompts to encourage Assistant to think. Instead of asking "Can you explain this script to me?" and pasting in the script, ask it to explain step-by-step by separating the question from the script with ###. This separation helps Assistant deconstruct and organize the information to provide better answers.

Can you explain what this script is doing step by step?

###

local part = workspace.Part

local function onTouched(otherPart)
    print(part.Name .. " collided with " .. otherPart.Name)
end

part.Touched:Connect(onTouched)

###

Certainly! This script is an example of how to handle collisions between two parts in Roblox. Let's break it down step by step:

  1. local part = workspace.Part: This line of code creates a local variable named part and assigns it the value of the Part object located in the workspace. You can replace Part with the name of the specific part you want to detect collisions with.
  2. local function onTouched(otherPart): This line of code defines a function named onTouched that takes in a parameter otherPart. This function will be called whenever the part collides with another part.
  3. print(part.Name .. " collided with " .. otherPart.Name): This line of code prints a message to the output console, indicating that the part has collided with otherPart. The part.Name and otherPart.Name are concatenated using the .. operator to form the message.
  4. part.Touched:Connect(onTouched): This line of code connects the onTouched function to the Touched event of part. Whenever the part collides with another part, the onTouched function will be called.

Examples

These examples demonstrate the vast variety of tasks that Assistant can help with today. Some of them might take a few tries for you to reproduce, but give them a try and see what you can come up with yourself.

Game mechanics - Shoot fireballs that explode

Prompt: Propel a fireball away from the player in the direction the player is facing when the player presses "e". Make the fireball explode when it hits something.