Make sound play at a certain position

As the title mentions I just want my sound to play from a certain position and as we go further from the position the sound can be heard less.
Just like how sound works in real life.
I have tried using Sound Service but for some reason I cannot cope up or understand it very well so I am getting help here.

I have searched for “How to make sound play in a position” but found no solution or if there was I am sorry to have missed it.

Thanks.

Pretty sure if you put the sound in the part, it plays in the part, and as you get further away, it sounds farther away. Or if that doesn’t work you can use a runservice heartbeat, and check the position from the sound within the part, and reduce the volume on the client depending on how close they are to the sound part.

3 Likes

Is there any way to make a sound play at a Position ( Vector3 ), and not have to create a part and parent the sound to it?

I don’t believe so. Read this:
A sound placed in a BasePart or an Attachment will emit its sound from that part’s BasePart.Position or the attachment’s Attachment.WorldPosition . A sound exhibits the Doppler effect, meaning its frequency and pitch varies with the relative motion of whatever attachment or part it is attached to. The volume of the sound will be determined by the distance between the client’s sound listener (by default the Camera position) and the position of the sound’s parent. For more information on this see Sound.RollOffMode .

(Source: Sound | Roblox Creator Documentation)

3 Likes

Thank you so much for the help.
Actually I never read the (Sound API reference) thus I was very unaware of these informations.
This helps alot.

Please do check out the API for everything for any questions about events, and/or everything. Because it does have almost everything.

Pretty sure you have already figured it out in 2 years but i still wanted to post a little function that will do the trick just in case(and i did mess up 2 times for some reason):

--a = The audio objects reference,
--pos = The position it will play
local function SpawnAudio(a,pos)
	local p = Instance.new("Part")
	p.CanCollide,p.CanTouch,p.CanQuery = 0,0,0
	p.Transparency,p.Anchored = 1,1
	p.Name = "AudioHolder"
	p.Size,p.Position = Vector3.new(0.1,0.1,0.1),pos
	local a_ = a:Clone()
	a_.Parent = p
	p.Parent = workspace
	a_:Play()
	game.Debris:AddItem(p,a.TimeLength)
end
1 Like