Why isn't this working?

You can write your topic however you want, but you need to answer these questions:

  1. What do you want to achieve? Keep it simple and clear!
    I’m trying to make a button that hides/shows a gui
  2. What is the issue? Include screenshots / videos if possible!
    It isn’t working. No errors.
  3. What solutions have you tried so far?
    I looked almost everywhere
local frame = game.StarterGui.ScreenGui1.ScrollingFrame -- Target (Don't edt this)

script.Parent.MouseButton1Click:connect(function() -- Functions Below if Player's mouse hits a button
	if frame.Visible == false then -- I honestly don't know
		frame.Visible = true -- Once player's mouse hits the button the frame will open
		frame.Visible = false -- If hit again then it closes

Please do not ask people to write entire scripts or design entire systems for you. If you can’t answer the three questions above, you should probably pick a different category.

It doesn’t work because StarterGui isn’t a thing that you can change like that. Please show the explorer to help explain what you need to do.

It becomes PlayerGui I believe instead of StarterGui. StarterGui is just the starting name in explorer for the folder that gets replicated to each player.

how do i get playergui? I can’t find it

You get it from the script, it’s not really something you can get otherwise. An example would be if you put a frame in StarterGui, then put a LocalScript under it. You don’t reference it with game.StarterGui, you do so like this:

local frm = script.Parent -- the right way

local frm = game.StarterGui.Frame -- don't do this

Please try to change your script to do something similar, it won’t work if you use StarterGui.

local frame = game.StarterGui.ScreenGui1.ScrollingFrame
So that would be
local frame = game.ScreenGui1.ScrollingFrame

No, it would be script, followed by the path. Remember that you can go up a level with parent, so you can use this to reference your GUI starting from the script instead of game. For example, if you have a GUI element with a script inside it, you’d reference the GUI with script.Parent, referencing it from game and going down will not work.

So not a local script, just a script?

It has to be a LocalScript due to how GUIs work, sorry if I caused any confusion with that post.

Yeah I think I might watch a few more YouTube tutorials before I attempt to understand this