#Sound when Pickup?

1 messages · Page 1 of 1 (latest)

chilly tiger
#

I'm new to coding and had the quick question of how to make a noise when something is collected? I made a super basic obby just for learning experience.

bleak thicket
#

First create a sound object, then put your sound id inside of the sound object (you can get sound ids from the toolbox, or import your own).

Playing a sound from a server script (the "regular" one) will result in the whole server hearing it, likely not what you want I believe, on the other hand putting it into a local script will cause it to only play for the local player (the person that the script is attached to/directed at) which is what you probably want to achieve here.

Example script

script.Parent.Touched:Connect(function()
    local Sound = workspace.Sound -- where your sound is
    Sound.Parent = workspace.Part -- if you want the sound to come from an object, if not you don't need this line
    
    Sound:Play() -- plays the sound
end)

tried my best to make this as simple as possible but if didn't understand anything feel free to ask :3

chilly tiger
#

ty

bleak thicket
# obtuse meteor Spoonfeeding

They mentioned that they were new to coding, so i just assumed that they weren’t all to familiar with roblox studio as a whole. I wanted to make it as clear as possible?

harsh harnessBOT
#

studio** You are now Level 1! **studio