#how to add sound effects to buttons in roblox studio
1 messages · Page 1 of 1 (latest)
button.activated:(sound:playy()))
do i need to add another script or just put the code into the same script?
idk probably same script
ok thanks
its not working
is there a specfic script i should be using or what?
@deft moss
skull
you can use any script
button.Activated:Connect(function()
Sound:Play()
end)
something like that
"💀 " yw
- Insert a Sound
In the Explorer, go to StarterGui → open your ScreenGui.
Add a Sound object to the TextButton (or ImageButton) that you want to play the sound.
Set the SoundId property to the sound you want, e.g.:
rbxassetid://12345678
(Replace with a real sound asset ID. You can find sounds in the Toolbox.)
- Use a LocalScript for the Button Click
Add a LocalScript inside the same button.
Paste this code:
lua
Copy
Edit
local button = script.Parent
local sound = button:WaitForChild("Sound")
button.MouseButton1Click:Connect(function()
sound:Play()
-- You can also add more code here, like opening menus or doing actions
end)