I'm trying to make a background music volume setting.
The current script is this:
script.Parent.MouseButton1Click:Connect(function() if game.SoundService.BackgroundMusic.Volume <= 1 then game.SoundService.BackgroundMusic.Volume = game.SoundService.BackgroundMusic.Volume + 0.1 script.Parent.Parent.Value.Text = game.SoundService.BackgroundMusic.Volume elseif game.SoundService.BackgroundMusic.Volume == 1 then return end end)
I have some text that displays the current volume of the background music. But everytime i change the volume with the script. It changes to 0.00000142141.
I want to change it so it's just 0.1
Thanks.
function round(num, numDecimalPlaces) local mult = 10^(numDecimalPlaces or 0) return math.floor(num * mult + 0.5) / mult end
This is just an example. The variable numDecimalPlaces is how many decimal places you want to round to (you want one place for your script, I bet). The variable num is the number you want to round.