I didn't want to make the question too big, but I also want to know how to make it change volume when you move closer or back away from the object playing the sound.
ex: http://www.roblox.com/games/148634071/Ocean-Drive
Just to inform, I'm an early learner in script, so I don't know much about how things work. It'd also be appreciated if there is any help that if you could give me a description on how it all works (not saying you have to, but it'd help a lot!)
Thanks!
Place the Sound
object in the object, and then do Sound:Play()
.
For example...
local part = workspace.YourPart -- reference the Part from the Workspace local sound = game.ReplicatedStorage.YourSound:Clone() -- get the Sound from somewhere, in this case, ReplicatedStorage, and clone it sound.Parent = part -- move the Sound to the Workspace function playSound() sound:Play() -- play the sound end part.Touched:connect(playSound) -- when the Part's Touched event is called, execute playSound()
More information can be found regarding sounds on this wiki article.