Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
-3

Volume Changer?

Asked by 8 years ago

I want to make a volume changer where you click the button and and it makes it louder and press a different one it makes it less loud im doing this with a GUI. Would it be like game.Worspace.sound.Volume: Add .1? or different?

2 answers

Log in to vote
0
Answered by 8 years ago

Please provide explanation with your answers. Simply posting code does not spread knowledge of integral scripting processes which helps people understand the logic and reasoning behind your answer.

Why did you downvote bubbaman's answer? It's correct.

local gui = script.Parent -- holder
local up = gui.VolumeUp
local down = gui.VolumeDown
local sound = game.Workspace.sound
local changeAmount = 0.1

up.MouseButton1Click:connect(function()
    sound.Volume = sound.Volume + changeAmount
end)

down.mouseButton1Click:connect(function()
    sound.Volume = sound.Volume - changeAmount
end

Hope I helped :)

2
Though this answer is correct, it is always a good idea to explain what the code does and how it works so the player can learn from it :P Uroxus 350 — 8y
Ad
Log in to vote
0
Answered by 8 years ago

workspace.sound.Volume = workspace.sound.Volume +.1
0
This doesnt change? ken12345678900000000 0 — 8y

Answer this question