im trying to make an about the game thing and when you press the button its supossed to make a frame visble value true and a bool value true i dont know why it wont work
heres the code
local ABOUTButton = script.Parent local IsOpenBool = script.Parent.IsOpen local function Open() game.StarterGui.MENU.ABOUTBACKROUND.Visible = true IsOpenBool.Value = true end local function Checkifopen() if IsOpenBool.Value == true then IsOpenBool.Value = false game.StarterGui.MENU.ABOUTBACKROUND.Visible = false end end ABOUTButton.MouseButton1Click:Connect(function() Open() Checkifopen() end)
Instead of game.StarterGui use Player.PlayerGui. StarterGui is not visible to the player, all that it does is whenever you spawn it clones everything inside to PlayerGui
READ: Overall this is a good script aside from the errors. First, this needs to be in a local script(which it is probably). Also, the main problem with the script is that you tried to get to the gui through startergui(a common mistake), if this is a local script(which it has to be to work and also you should always use localscripts for guis), then you can get to the player and their gui through: game.Players.LocalPlayer.StarterGui, the rest is exactly what is in startergui. Third of all, I put everything into a single mouseclick function to make it more simple. Basically, this edited version of your script activates a function that checks if it is either open or closed on mouseclick. Hope this helped :)
local ABOUTButton = script.Parent local IsOpenBool = script.Parent.IsOpen local function OpenorClose() -- this function is for both opening and closing using ifs if IsOpenBool.Value == false then -- if it is closed then open it game.Players.LocalPlayer.PlayerGui.ScreenGui.MENU.ABOUTBACKROUND.Visible = true IsOpenBool.Value = true end elseif IsOpenBool.Value == true then --use elseif because there is already an if in the function IsOpenBool.Value = false game.Players.LocalPlayer.PlayerGui.ScreenGui.MENU.ABOUTBACKROUND.Visible = false end end ABOUTButton.MouseButton1Click:Connect(OpenorClose)
Note: There may be minor typing mistakes in the script