local player = game.Players.LocalPlayer local sound = player.Aviici function Click() player.sound.Volume = 0 end function Click() player.sound.Volume = 0.25 end script.Parent.MouseButton1Down:connect(Click) script.Parent.MouseButton1Down:connect(Click)
so, i want the player make when it clicks the gui, makes the song be muted in Players > Player like here: http://prntscr.com/89kfif
At line 1-2:
local player = game.Players.LocalPlayer.Aviici local sound = player.Aviici
You already set player
as the sound. So at line 2, the script will see if there's a other sound inside the sound on player.
In line 6 and 11, it's when the script will get confused. In scripting, you need to understand, you don't use a variable and a other variable to locate something. For example
local x = script.Parent local y = x.Parent x.y.BrickColor = BrickColor.new("Really black") -- WRONG --/\/\ --That CANNOT happen y.BrickColor = BrickColor.new("Really black") -- RIGHT
So your script would be:
local player = game.Players.LocalPlayer local sound = player.Aviici function Click() sound.Volume = 0 end function Click() sound.Volume = 0.25 end script.Parent.MouseButton1Down:connect(Click) script.Parent.MouseButton1Down:connect(Click)
IMPORTANT TIP: Use Output. It will say the errors you cause.
you have two functions with same name. and your calling them both at the same twice. just use one function and make a check to see which action to do... like so...
local player = game.Players.LocalPlayer local sound = player.PlayerGui:WaitForChild("Aviici") sound:Play() local function Click() if sound.Volume == 0 then sound.Volume = 0.25 else sound.Volume = 0 end end script.Parent.MouseButton1Click:connect(Click)