Dialog
The Dialog object allows users to create non-player characters (NPCs) that players can talk to using a list of choices. The Dialog object can be inserted into a part such as a Humanoid's head, and then a player will see a speech bubble above the part that they can click on to start a conversation. The creator of a place can choose what choices the player can say by inserting DialogChoice objects into the dialog.
Summary
Properties
Sets whether the Dialog can be used by multiple players at once.
The furthest distance that a player can be from the Dialog's parent to start a conversation.
Toggles whether the goodbye option will be displayed.
Sets the sentence that the dialog will show to the player when the chat ends.
If true, this dialog is being used by at least one player.
Sets the first sentence that the dialog will show to the player, once a chat is commenced.
Sets the icon that the initial dialog displays.
Sets the color of the NPC's speech bubble.
Sets the maximum distance that a dialog can be triggered from.
Sets the offset of the dialog relative to the dialog's parent.
Methods
Returns a list of players currently using the Dialog.
Events
Fired when a player chooses something to say, through a Dialog instance.
Properties
BehaviorType
ConversationDistance
GoodbyeChoiceActive
GoodbyeDialog
InUse
InitialPrompt
Purpose
Tone
TriggerDistance
TriggerOffset
Methods
GetCurrentPlayers
Returns
Code Samples
local dialog = script.Parent
local function onChoiceSelected(_player, _choice)
local currentPlayers = dialog:GetCurrentPlayers()
print("The current players in the dialog:")
for _, player in ipairs(currentPlayers) do
print(player)
end
end
dialog.DialogChoiceSelected:Connect(onChoiceSelected)