Reputation: 15
A player is having conversation with an npc .Now , the player selects a Dialog Choice.Then, some actions happen.How do i do that?I'm learning lua.I'm Novice.I'm tryingg my best.And another thing I need to know that to make it happen where I should put the script and Which type of script I should put.Thnx for your patience! :)
Upvotes: 1
Views: 514
Reputation: 28
This should work for making the selected dialog box trigger an action:
game.Workspace.YourDialogBox.DialogChoiceSelected:connect(function(player,choice)
if choice.Name == "Selection 1" then
--Your Selection 1 Code Here
elseif choice.Name == "Selection 2" then
--Your Selection 2 Code here
end
end)
Adjust your code according to where your dialog box is and what will happen to perform the action. You can find more about it here: https://developer.roblox.com/en-us/articles/Usage-of-dialogs
Upvotes: 1