I'm trying to make a dialog choice that when selected plays a sound effect. Can somebody help me out?
very easy and simple :) by using DialogChoiceSelected we can check to see if a certain choice was selected, and do something.
https://www.roblox.com/library/59391730/Advanced-Player-AI
in the player model go to "Head", insert Dialog. under Dialog insert DialogChoice. I inserted two, "Yes" and "No" make sure the names are spelled exactly as you put them in code (case sensitive)
insert an Audio in ReplicatedStorage and make a local variable pointed to that audio
the following script goes under StarterGui
local Dialog = game.Workspace.Player.Head.Dialog local Voice = game.ReplicatedStorage["YES! YES!"] Dialog.DialogChoiceSelected:Connect(function(player,choice) if choice.Name == "No" then player.Character.Humanoid.Health = 0 elseif choice.Name == "Yes" then Voice:Play() end end)
and boom. if you say no you die, if you say yes the audio played
hope I helped, accept the answer if I did :)