Can't set a sound range

  1. What do you want to achieve? Keep it simple and clear!
    I want to set the sound range of a sound instance.

  2. What is the issue? Include screenshots / videos if possible!
    The issue is that RollOffMaxDistance and MaxDistance doesn’t work.

  3. What solutions have you tried so far? Did you look for solutions on the Developer Hub?
    I tried RollOffMaxDistance and MaxDistance

-- Modules
local Config = require(script.Parent.Parent.Modules.Config)

-- Tool
local Tool = script.Parent.Parent

-- Anim Folder
local AnimFolder = Tool.Animations

-- Sounds Folder
local SoundFolder = Tool.Assets.Sounds

-- Animation Instances

for i,v in pairs(Config.Animations.SlashAnimations) do
	if not v.Enabled then continue end

	local Anim = Instance.new("Animation")
	Anim.Parent = AnimFolder
	Anim.Name = i
	Anim.AnimationId = v.AnimationId
end

for i,v in pairs(Config.Animations.OtherAnimations) do
	if not v.Enabled then continue end

	local Anim = Instance.new("Animation")
	Anim.Parent = AnimFolder
	Anim.Name = i
	Anim.AnimationId = v.AnimationId
end

-- Sound Instances
for i, v in pairs(Config.Sounds) do
	if not v.Enabled then continue end

	local Sound = Instance.new("Sound")
	Sound.Parent = SoundFolder
	Sound.Name = i
	Sound.SoundId = v.SoundId
	Sound.Volume = v.Volume
	Sound.MaxDistance = v.MaxDistance
end

Change sound.RollOffMode to Linear.

I need someone to check with me. Let me ask my friend to check if it works.

image
Btw I did this

It didn’t work. And I don’t know why.

image
btw this the rolloffmaxdistance that I’ve put

Just to make sure are you settings this values on server? I m asking because you said that you are testing this with friend.

Yes, I’m setting this values on server.

1 Like

Im pretty sure RollOffMode needs to be RollOffMode LinearSquare instead

1 Like

It didn’t work
image

That’s really weird everything looks fine. What’s the problem exactly? I mean sound MaxDistance is not working properly for you or for someone else on the server?

You said the max distance was 5?
That’s five studs you probably can’t hear that from very far away
Also the sound must be parented to a part otherwise it wont work.

1 Like

Oh, it is parented to a folder. Should I parent it to the Handle?

1 Like

Yes that will probably fix your problem
Anything that’s a part will work because it needs a physical point in time and space to emit sound from.

1 Like

Those properties will only have an affect if the sounds are placed inside physical instances in the 3D environment.

2 Likes