How do MaxDistance and EmitterSize work for sounds? I've been trying to figure this out for a while for my radio script I'm working on but I can't figure out what to set the values for these as so they don't play throughout the entire server and instead just a small area. The script:
local player = game.Players.LocalPlayer
repeat wait() until player.Character~= nil
local frame = script.Parent
local play = frame.Play
local speaker = frame.Speaker
local input = frame.InputBox
local song = Instance.new('Sound',frame)
local playtoggle = true
local speakertoggle = true
local char = player.Character
song.Looped = true
song.PlayOnRemove = false
song.Volume = 3
play.MouseButton1Click:connect(function()
if playtoggle == true then
print('playing')
song.SoundId = 'rbxassetid://' .. input.text
song:Play()
play.Text = 'Stop'
playtoggle = false
print(playtoggle)
wait(0.5)
elseif playtoggle == false then
print('stopping')
song:Stop()
play.Text = 'Play'
playtoggle = true
print(playtoggle)
wait(0.5)
end
end)
speaker.MouseButton1Click:connect(function()
if speakertoggle == true then
song.Parent = char
speaker.BackgroundColor3 = Color3.new(0,255,0)
speakertoggle = false
print('speakeron')
wait(0.5)
song.EmitterSize = 1
print('Emittersize is ' .. song.EmitterSize)
song.MaxDistance = 10
print('MaxDistance is ' .. song.MaxDistance)
elseif speakertoggle == false then
song.Parent = frame
speaker.BackgroundColor3 = Color3.new(255,0,0)
speakertoggle = true
print('speakeroff')
wait(0.5)
end
end)
I've tested this code on a server running on two separate computers to test the range of the sound a few times and I think there may be something wrong with it as I can still hear the song from the other side of the map even when it seems to fade, can someone point out what's wrong with it if so?

3 comments
@RjsMc is correct
@RjsMC Thanks, I tried this and it didn't work, but I checked out the emitter size page and realised it needed to be a child of a part for it to work. I was putting it in the character model, so I just had to make it a child of the head, so thanks!
Not even I knew that lol. The more we know xD