local player = game.Players.LocalPlayer
local trigger = true -- On {0.25, 0},{0.5, 0} c =34, 255, 0
local destroy = coroutine.create(function()
while trigger == true do
wait()
game.Workspace:FindFirstChild("CurrentSong").Volume = 0
end
end)
script.Parent.MouseButton1Click:Connect(function()
if trigger == true then
print("Music Disabled")
coroutine.resume(destroy)
if game.Workspace:FindFirstChild("CurrentSong") == nil then
for i, v in pairs(game.Workspace.MainFrame.Songs:GetChildren()) do
v.Volume = 0
end
else
game.Workspace.CurrentSong.Volume = 0
end
script.Parent.Parent.Move:TweenPosition(UDim2.new(0.75, 0, 0.5, 0), "Out", "Quart", 0.3)
script.Parent.Parent.Move.ImageColor3 = Color3.fromRGB(255, 78, 81)
trigger = false
else
print("Music Enabled")
if game.Workspace:FindFirstChild("CurrentSong") == nil then
for i, v in pairs(game.Workspace.MainFrame.Songs:GetChildren()) do
v.Volume = 0.5
end
else
game.Workspace.CurrentSong.Volume = 0.5
end
script.Parent.Parent.Move:TweenPosition(UDim2.new(0.25, 0, 0.5, 0), "Out", "Quart", 0.3)
script.Parent.Parent.Move.ImageColor3 = Color3.fromRGB(34, 255, 0)
trigger = true
end
end)
This is my current script for the settings menu and for some reason it worked but has stopped working, I get an error saying [attempt to index nil with āVolumeā] on line 6 but not sure how to fix this. Btw Iāve only recently started scripting. Any fixes are appreciated!