So?
This must work, this closes gui which you named “ShopFrame”
Is it in LocalScript?
If I’m wrong, I ask you to correct me. As I understand it, you want that, when clicking on a specific button (I believe it is the parent of the script), the ShopFrame gui will close. I am not focused on this gui area, but I believe that the script is totally correct, and my hypothesis is that it is in ServerScript and not in LocalScript. If in fact I identify an error, I will reply to my post.
Edit: Literally as soon as I sent it I identified an error. When you intend to make a frame invisible you will not use “Visible”, as in the case of the line: “ShopFrame.Visible = false”. In this case you should use “Enabled”, replacing it with: “ShopFrame.Enabled = false”.
Not really, Frame has the Visible property and if you turn it to ‘false’ the Frame and It’s descendants will all be invisible/will not be rendered. (Check frame at the api-reference)
But is he setting the Frame’s property or the ScreenGui’s property? Guis have the Enabled property.
From what I saw now, I believe it is a frame, but only with it confirming us such a thing, but if it is indeed a frame, just check if it is a LocalScript or not. If are a ScreenGui, just change from “Visible” to “Enabled”.
This topic is actually a duplicate of this topic: Trying to make a Shop and Menu GUI but Failed, In which shows that he’s actually trying to change the Visible property of a Frame, and script.Parent.Parent is a Frame called “ShopFrame”.
Your local ‘Menu’ is wrong, since you the UI you’re looking for is inside the PlayerGui, It’s not directly inside the Player object.
Try changing the local to:
local Menu = game.Players.LocalPlayer.PlayerGui
Of course you’re gonna need to put the correct location if It’s wrong.
I don’t see Menu frame in the explorer, are you sure you got all the names correct? Could we see another image of your explorer?
I’m not sure if this actually affects anything but please remove that breakpoint/the arrow at the ‘4’ in the script, and then test it.
Also your local ‘Menu’ is wrong once again. It should be:
local Menu = game.Players.LocalPlayer.PlayerGui.Menu
if you’re trying to get the Menu ScreenGui.
In your script you say AvatarButton.PlayButton, but in the explorer we can see that PlayButton is not a child of AvatarButton. You might want to learn some more about scripting before you ask the devforum. I would recommend the devkings scripting tutorials:
what arrow are you talking about? if you mean error that would kind be hard cause im still short on lua
I didn’t really understand what you meant but what I were saying is that your local ‘Menu’ is incorrect, since ‘MenuFrame’ doesn’t exist in the PlayerGui.
As @XdJackyboiiXd21 said I recommend watching more videos, since errors like that are easily preventable and basic, tutorials can really help you with those.
Always pay attention to those little errors as they can break your whole script.
You were trying to find MenuFrame inside PlayerGui
local Menu = game.Players.LocalPlayer.PlayerGui.MenuFrame
But you can clearly see MenuFrame isn’t directly inside PlayerGui, but inside ‘Menu’.
You were also trying to get ‘PlayButton’ inside AvatarButton, but you can also see PlayButton is not inside AvatarButton.
I believe this is the exact code you need to put in
function onClick()
script.Parent.Parent.Visible = false
end
script.Parent.MouseButton1Click:Connect(onClick)
^ to make the ShopFrame invisible
function onClick()
script.Parent.Parent.Parent.Parent.Menu.MenuFrame.Visible = false
end
script.Parent.MouseButton1Click:Connect(onClick)
^ To make the MenuFrame invisible
I didn’t know which one exactly you wanted so I put in both
AYYY it works thanks man I tested it
It worked, but you know how to make it so on computer you click " M " and then it pops up
This is one way you can do it, though I recommend not using it unless you have a text button to open it in addition, because mobile players don’t have keyboards…
local m = game.Players.LocalPlayer:GetMouse()
m.KeyDown:connect(function(key,mouse)
key = key:lower()
if key == "m" then
script.Parent.Parent.Parent.Parent.Menu.MenuFrame.Visible = false
--or
script.Parent.Parent.Visible = false
-- either one
end
end)
The games only going to be on computer for now