So in my game, or project, I have a script that inserts an explosion wherever the player clicks, and plays an explosion sound. I know how to get the distance from the character from where the person clicked, but how would I convert the distance to the sound's volume, that can only be > 0 but < 1?
Here's a basic script that will help to demonstrate what I'm saying,
local plr = game:GetService("Players").LocalPlayer
local mouse = plr:GetMouse()
local char = plr.Character or plr.CharacterAdded:wait()
local Torso = char:WaitForChild("Torso")
local Sound = script:WaitForChild("Sound")
mouse.Button1Down:connect(function()
local Distance = (Torso.Position - mouse.Hit.p).Magnitude
Sound.Volume = --I need help with this part
Sound:Play()
end)
However, a few of the problems I've come to are that,
The distance get's larger instead of shorter the farther the player clicks
I'm not sure how to make the lower number larger than the bigger number
And I suck at math
This might be harder than I hope, but any solution would help.
Thank You.

2 comments
This was a great answer, and it helped me to form an idea of how to solve the problem. Thank you.
I hope roblox will add MaxDistance and MinDistance for sound and add a sound fade soon :/