I want to add effects like sparkles to brick and when you click it, the sound will play and also sparkling. How can I do that?
Brick = script.Parent
Sound = Brick.Sound
Debounce = false
function onClicked()
if not Debounce then
Debounce = true
Sound:Play()
wait(Sound.TimeLength)
Debounce = false
end
end
script.Parent.ClickDetector.MouseClick:connect(onClicked)
Am I doing this right?
sparkles = Instance.new("Sparkles")
sparkles.Parent = Brick
Brick = script.Parent
Sound = Brick.Sound
Debounce = false
function onClicked()
if not Debounce then
Debounce = true
Sound:Play()
wait(Sound.TimeLength)
Debounce = false
end
end
script.Parent.ClickDetector.MouseClick:connect(onClicked)

2 comments
Can you check if I do it right? Check the second script.
add the sparkles in directly after the Debounce = true line, and then add a line that says sparkles:Destroy() directly before the Debounce = false line.