Hello everyone, today I was trying to make a button that opens another Gui, like a shop. I want it to have 3 purposes, like if the Gui is visible it will become not invisible, then if it is invisible it will become visible, Like open and closing. Also I tried to make it play a sound when you click on it but nothing works, please help if you can!
function die() if script.Parent.ImageLabel.Visible = true script.Parent.ImageLabel.Visible = false else script.Parent.ImageLabel.Visible = true Game.Workspace.StarterGui.Sound3:Play() end script.Parent.MouseButton1Down:connect(die)
I think you need a true or false value to make it work. This is made assumed that the Image Label is already visible.
local enabled = true function die() if enabled == true then script.Parent.ImageLabel.Visible = false else script.Parent.ImageLabel.Visible = true Game.Workspace.StarterGui.Sound3:Play() end script.Parent.MouseButton1Down:connect(die)
I typed this on the fly so I am not sure if it will fully work, but I am confident it will work.