I have this game that's almost finished! There's someone that you chat with (using dialog), and I want to make it so a specific dialog response turns on music. How would I go by doing this? I can't even seem to connect the script to the dialog in the first place! (The choice that is supposed to trigger the music is called DialogChoice1).
So, in order to do this, you need to access the Dialog.DialogChoiceSelected
event.
Here's an example of how to do it.
local dialog = --[path to dialog] local dialogChoice1 = --[path to dialogchoice1] local music = --[path to music sound] dialog.DialogChoiceSelected:Connect(function(player, dialogChosen) if dialogChosen == dialogChoice1 then music:Play() end end)
Hope this helped!
P.S. Here's where I got the information. This is a very useful Wiki page. https://developer.roblox.com/en-us/api-reference/event/Dialog/DialogChoiceSelected