Can hear sound from far away

Hello! So whenever someone Collects a coin or sells, you can hear the sound from far away. How can I fix this?

This is my sell script

local Part = script.Parent
Part.Touched:Connect(function(HIT)
	local H = HIT.Parent:FindFirstChild("Humanoid")	
	if H then
		local player = game.Players:GetPlayerFromCharacter(HIT.Parent)	
		if player then
			local leaderstats = player:WaitForChild("leaderstats")
			local Currency = leaderstats.Money
			local Selling = leaderstats.Coins
			if Selling.Value > 0 then
				Currency.Value = Currency.Value + Selling.Value *0.5
				Selling.Value = 0
				local Sound = Instance.new("Sound",HIT.Parent)
				Sound.SoundId = "rbxassetid://7481325068" -- Whatever the sound id you want to play is goes here
				Sound:Play()
				game.Debris:AddItem(Sound,1)
				script.Parent.explosion.Enabled = true
				wait(1)
				script.Parent.explosion.Enabled = false
			end
		end
	end
end)

and here is the coin script, this also goes for anything else that plays sound from a player, and yes, they’re all scripts not localscripts

local db = true
script.Parent.Touched:connect(function(hit)
	if hit.Parent:FindFirstChild("Humanoid") ~= nil then
		if db == true then
			db = false
			script.Parent.Transparency = 1
			local player = game.Players:GetPlayerFromCharacter(hit.Parent)
			player.leaderstats.Coins.Value = player.leaderstats.Coins.Value + 1
			script.Sound:Play()
			script.Parent.Transparency = 1
			wait(5)
			db = true
			script.Parent.Transparency = 0
		end
	end	
end)

Any help will be appreciated! :grinning_face_with_smiling_eyes:

https://developer.roblox.com/en-us/api-reference/property/Sound/RollOffMaxDistance

1 Like

Oh thank you! I completely forgot this even existed! Thanks!