Play a local sound when clicking dialog question mark

  1. What do you want to achieve? I want to play local sound in Sound Service when you click the question mark from dialogs.
  2. What is the issue? Include screenshots / videos if possible!
    The sound keeps playing as soon as I join the game, and when I click the question mark, no sounds appear.
  3. What solutions have you tried so far? Did you look for solutions on the Developer Hub?
    I keep getting this error from the script below:

    Yes, I asked for help on many developing Discords like Hidden Devs and Ro Devs.
local Dialog = script.Parent.Dialog
local Intro = game.SoundService.Ara
local Player = game:GetService("Players").LocalPlayer

while wait() do -- a constant loop

	local PlayersInUse = Dialog:GetCurrentPlayers() --the players currently using the dialog.
	if #PlayersInUse > 0  then

		for i,v in pairs(PlayersInUse) do
			print (v)

			if v:GetAttribute("Name") == Player.Name then
				Intro:Play()
				local ended = false
				repeat
					if not table.find(PlayersInUse, Player.Name) then
						ended = true
					end
					wait()
				until ended == true
			end
		end
	else
		Intro:Stop()
		print("No Player using the dialog")
	end
end
1 Like

Have you tried using this? Dialog | Roblox Creator Documentation

Use a local script and you should be able to play the sound locally when the player clicks on it.