Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
-3

How can I make a NPC's RepsonseDialogue be multiple choice/random awnser? [closed]

Asked by 3 years ago

So I'm trying to make ordering/cashier system like Work at a Pizza Place. But, I'm stuck. I don't know the dialogue system very well. So, I'm asking for some help on making a NPC's ResponseDialogue being a random choice out of 4 choices, instead of one response dialogue.

Closed as Not Constructive by raid6n, TheWaterFoox, and Leamir

This question has been closed because it is not constructive to others or the asker. Most commonly, questions that are requests with no attempt from the asker to solve their problem will fall into this category.

Why was this question closed?

1 answer

Log in to vote
2
Answered by 3 years ago

This creates an initial prompt so that when you click the dialog the prompt's object/character will tell you one of the three in the table.

local Dialog = Instance.new("Dialog")
Dialog.Parent = script.Parent -- script.Parent refers to the object this script is under.
local Prompts = {
    [1] = ("Hi!");
    [2] = ("Hey!"); 
    [3] = ("What's up!");
};
Dialog.InitialPrompt = Prompts[math.random(1,#Prompts)] -- math.random function picks a random prompt.
Ad