In this article, you will learn how you can make a dialogue in Roblox Studio with any NPC. With the help of dialogues, it will be possible to create a real plot with your own story or use dialogues to explain the rules, tasks, and quests. You can create a plot using the basic functions that are built into Roblox Studio.
How to Create a Dialogue with The NPC
- First of all, search for the NPC in the search bar and select the appropriate one.
- Click on the NPC and select Head from the menu on the right.
- Expand the Head of the character and if there is no Dialog file in it, click on + in Roblox Studio and add it yourself.
- Select the Dialog file and write a welcome message from the NPC in the InitialPrompt line (this is what he will say if you start a dialogue with him).
- Press the + button in Roblox Studio right after Dialog and add DialogChoice in order to continue the dialogue with the NPC and create phrases with which you will respond.
- Select DialogChoice and write the phrase that the player will have to answer in the UserDialog line, and in the ResponseDialog line write the phrase that the NPC will have to say.
- Then you can attach another DialogChoice to DialogChoice and write the phrases you need in order to continue the dialogue indefinitely.
RELATED: How to Save a Game in Roblox Studio
Additional Dialog Properties
Dialog.ConversationDistance: Set the maximum distance from which you can talk to an NPC. If you start at a distance and then step out of it, the conversation will end.
Dialog.Purpose: These are the various icons that appear above the NPC that you can click on.
Dialog.Tone: This is the color of the conversation – the speech bubble and GUI selection. Friendly is green, neutral is blue, and the enemy is red. You can add multiple DialogChoices to a Dialog so that the player has multiple choices.
You can also add even more functionality if you are good at Roblox Lua. With the help of functions and scripts, you can display the names of the Players in dialogues, display some characteristics, and much more. So, for example, this script will display the player’s name and the name of his choice in the dialog:
workspace.Dialog.DialogChoiceSelected:connect(function(player,choice)
if choice.Name == “No” then
player.Character.Humanoid.Health = 0
elseif choice.Name == “Yes” then
player.Character.Humanoid.Health = 1000
end
end)
More information on dialogues can be found on the Roblox Studio developers’ website.
Published: May 5, 2022 12:34 pm