Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How Do I Make A Dialog Sound When Click?

Asked by
ImfaoXD 158
8 years ago

How do I make a dialog with sound when you click the dialog? But also wait for the sound to cool off before click it again.

1 answer

Log in to vote
0
Answered by
Im_Kritz 334 Moderation Voter
8 years ago

This is for a GUI dialog button. You add the sound in the button, then you gotta code the click event:

local Dialog = script.Parent

Dialog.MouseButton1Click:connect(function()

end)

Then add the sound you want to play when you click the dialog:

Dialog.Sound:Play()

To have the player wait before being able to click again, add a debounce to it and put everything together:

local Dialog = script.Parent
local Debounce = false

Dialog.MouseButton1Click:connect(function()
if Debounce then return end
Deounce = true
Dialog.Sound:Play()
-- More code for the whole dialog
Debounce = not Debounce
end)
0
Am I doing this right? http://www.roblox.com/unnamed-item?id=314055773 ImfaoXD 158 — 8y
Ad

Answer this question