Sound play on remove 3dspace question

Just a small question. Does Sound | Documentation - Roblox Creator Hub play the sound at the parents location at time of removal?

Just wondering if I can just use this property instead of creating a coroutine to play a sound once at a position then destroying it like here.

Current methods of playing sounds once at a location
-- Sound Util
-- Dthecoolest
-- March 12, 2021

local SoundUtil = {}

function SoundUtil.playSoundAtPosition(sound: Sound, position: Vector)
	local soundPositionAttachment = Instance.new("Attachment")
	soundPositionAttachment.WorldPosition = position

	local sound = sound:Clone()

	sound.Parent = soundPositionAttachment
	soundPositionAttachment.Parent = workspace.Terrain
	coroutine.wrap(function()
		sound:Play()
		sound.Ended:Wait()
		sound:Destroy()
		soundPositionAttachment:Destroy()
	end)()
end
function SoundUtil.playSoundAtInstance(sound: Sound, workspaceInstance : Instance)
   assert(workspaceInstance:IsA("BasePart") or workspaceInstance:IsA("Attachment"),"Must insert 3d instance")
	local sound = sound:Clone()
	sound.Parent = workspaceInstance
	coroutine.wrap(function()
		sound:Play()
		sound.Ended:Wait()
		sound:Destroy()
	end)()
end

return SoundUtil
1 Like

From my testing, I believe it does play at the location of its Parent at the time of removal as I did a quick test being close to the part and being far away from the part, the further I got from the part after removal, the quieter the sound became, and vice versa, closer to it, the louder it was.

Basically, it plays at the location of the parent during remove from my testing. But if you want to be certain too, place a part with a sound inside it with PlayOnRemove enabled, and destroy it at a certain time, the sound should get quieter the further you are from the part when it is destroyed

2 Likes