:Statement spans multiple lines use indentation to silence
Local script located in Starter Gui:
local player = game.Players.LocalPlayer
local Sound = game.Workspace.Sound
local Text = script.Parent:WaitForChild("TextLabel")
local Button = script.Parent
function onClick()
if Sound.Volume == 0.4 then
Sound.Volume = 0
Text.Text = "Off"
Text.TextColor3 = Color3.fromRGB(255, 51, 0)
elseif
Sound.Volume == 0 then
Sound.Volume = 0.4
end
end
Button.MouseButton1Click:Connect(onClick)
As @megukoo sayed, you only need to change this line:
Sound.Volume == 0 then
To:
elseif Sound.Volume == 0 then
That’s the script at the end:
local player = game.Players.LocalPlayer
local Sound = game.Workspace.Sound
local Text = script.Parent:WaitForChild("TextLabel")
local Button = script.Parent
function onClick()
if Sound.Volume == 0.4 then
Sound.Volume = 0
Text.Text = "Off"
Text.TextColor3 = Color3.fromRGB(255, 51, 0)
elseif Sound.Volume == 0 then
Sound.Volume = 0.4
end
end
Button.MouseButton1Click:Connect(onClick)