Im trying to make the music turn on and off (currently testing). I can't see a problem. Help.
script.Parent.MouseButton1Click:Connect(function() if script.Parent.Value.Value == '1' then script.Parent.Parent.Parent.Parent.On.TextLabel.Text = 'Off' script.Parent.Value.Value = '0' end if script.Parent.Value.Value == '0' then script.Parent.Parent.Parent.Parent.On.TextLabel.Text = 'On' script.Parent.Value.Value = '1' end end)
You should probably use something like this
local on = true script.Parent.MouseButton1Click:Connect(function() if on == true then script.Parent.Parent.Parent.Parent.On.TextLabel.Text = 'Off' on = false elseif on == false then script.Parent.Parent.Parent.Parent.On.TextLabel.Text = 'On' on = true end end)
Sorry if this don't work, but it looks like it should for what you're trying to accomplish.
local ToggleValue = script.Parent:WaitForChild('Value') -- Looking for the value object script.Parent.MouseButton1Click:Connect(function() -- Click function ToggleValue.Value = not ToggleValue.Value -- Alternates the value between true and false if ToggleValue.Value then -- If ToggleValue is true... script.Parent.Parent.Parent.Parent.On.TextLabel.Text = 'Off' else -- If ToggleValue isn't true... script.Parent.Parent.Parent.Parent.On.TextLabel.Text = 'On' end end)