SurfaceGui Button not making ScreenGui frame visible?

script.Parent.MouseButton1Click:Connect(function(plr)
	if game.StarterGui.atm.atm.Visible == false then do
			game.StarterGui.atm.atm.Visible = true
		end
	end
end)

Why isn’t this script making the frame visible? This is a local script located within a Surface Gui’s Text Button.

Remove the do in if game.StarterGui.atm.atm.Visible == false then do

I changed it to this:

script.Parent.MouseButton1Click:Connect(function(plr)
	if game.StarterGui.atm.atm.Visible == false then
		game.StarterGui.atm.atm.Visible = true
	end
end)

Yet it still doesn’t work. It has no errors or anything.

“plr” Is not a valid first argument of MouseButton1Click

Also, make sure you are changing the player gui, not the starter gui

script.Parent.MouseButton1Click:Connect(function()
	plr.PlayerGui.atm.atm.Visible = true
end)

you should set plr = game.Players.Localplayer above

Is the SurfaceGui inside the part?

And, what are you trying to make visible? The player’s gui?

The SurfaceGui is in the part, and I’m trying to make a ScreenGui’s frame visible within the PlayerGui.

I found out for some reason it isn’t even printing, here is the hierarchy.image

Okay, so a TextButton can’t function inside a part, it must be inside the StarterGui. To do this, you can place the SurfaceGui inside the StarterGui and have the SurfaceGui’s Adornee connected to the part. Like so:

Also, your script has a slight problem. When playing the game, the StarterGui is not what a player uses. They have their own copied set of Gui’s inside their Player which you can find in Players. Here’s the fixed version of your code:

script.Parent.MouseButton1Click:Connect(function(plr)
	if plr.PlayerGui.atm.atm.Visible == false then
		plr.PlayerGui.atm.atm.Visible = true
	end
end)

Here, I replaced game.StarterGui with plr.PlayerGui because we’re looking for the player’s own set of gui’s, not the server’s.