I have made an Open/Close a GUI button for my Shop GUI. For some reason, when I click the button in studio it opens the frame. In-game and in team test it does not. Please help. This is the code I used:
local Button = script.Parent Box = script.Parent.Parent.ScrollingFrame function onClick() if Box.Visible == false then Box.Visible = true elseif Box.Visible == true then Box.Visible = false end end Button.MouseButton1Click:connect(onClick)
Since it turns visible in studio but not in game, that means you're most likely using a script for this. Scripts can't run in the PlayerGui, so you'll have to use a localscript.
local Box = script.Parent.Parent:WaitForChild(”ScrollingFrame”) As things may not have loaded yet, the script will be broken, you should almost always use WaitForChild(), and second, this will only work in a local script as a ServerScript cant access the playergui