Open and close Gui is not working

Ok so, sorry I had an urgent matter to attend to. But, for some reason, the GUI still does not come up in game, but in studio it does! Any help here?

Did you click “Publish to Roblox” or “Save to Roblox” once done editing? You need to Publish the game in order for the changes to appear in live servers, outside of Studio.

So you’re saying that while playtesting inside of Studio, the Frame doesn’t appear when you click the button?

Also, when you said:

Are you saying that before you clicked “Play” inside of Studio, that is the only time it shows up on the screen? You are not able to activate the buttons by clicking on the screen at that point, so I’m confused by that statement.

I’m not sure if this place you’re working on has Team Create/Collaborative Editing enabled or not, so make sure that you have saved the changes of the script (via the drafts) if that is the case, so that the script will update properly in playtesting environments.

1 Like

Ok, so in studio


Its fine
In game

Doesn’t come up when I click the icon
And in game, when I try and turn the visible on manually it doesn’t work either

Do you know how to fix this???

1 Like

As far as the final screenshot goes, it might be (I’m not entirely sure) because you’re toggling the Frame’s visibility on the server (the one that is duplicated to each player upon spawning), and not via the GUI that has been duplicated into the player’s StarterGui folder (to find this, open the Players service, open the player, PlayerGui folder, then the ShopGui from there).

Did you ensure that the code in the LocalScript is running properly? Try adding in “print” statements in order to debug the code and see if there’s a point where it is not running/erroring.

1 Like

The Position is off the screen.
image

2 Likes

The first screenshot within his reply shows it visible in the center of the screen, with the position remaining the same as it is in the final screenshot, so I don’t believe that that would be the case, but it would probably be better for the OP to change its offset in case that could be what is causing it to happen.

Also, @octavodad, the “Scale” is the first value and “Offset” is the second value when it comes to positioning and size of GUI Objects, just FYI in case you needed to know.

Edit: Here’s a wonderful guide that also covers this just in case you’re interested

1 Like

You can’t toggle visibility using that, you would have to go into game.Players.YOURNAME.PlayerGui.ShopGui.MainFrame instead of using the startergui, since it only is replicated once

2 Likes

Ahh, I see… Sorry for the late reply :smiley: But how would you change it so that you toggle it on the player side of things? This is a new concept for me. @StrongBigeMan9

Try toggling it when it is a play test, if it doesn’t show up then its a problem with the Gui, if it does, its a script problem

1 Like

So… It comes up when I toggle in the player side

1 Like

It likely comes down to an error within the script, then. When you try to click the button, do any errors appear in the Output?

1 Like

Nope, no errors at allllllll (dammit)

Is the script running, or is the event firing? Try putting a breakpoint on a line in the connect function (by clicking next to the line number so that a red dot shows)

2 Likes

I would suggest trying what the user above mentioned, however, if you are unfamiliar with breakpoints, try adding in print statements before/after lines of code where something is supposed to happen. This will help you see to what extent of the script is running.

For example, you could have something like this:

Button.Activated:Connect(function()
    print("Button has been activated")

    -- Code here if you have more things

    Frame.Visible = not Frame.Visible
    print("The frame's visibility has been changed")
end)
1 Like

Tried this, but its not printing

script.Parent.MouseButton1Click:Connect(function()
print("hello")
	script.Parent.Parent.MainFrame.Visible = not script.Parent.Parent.MainFrame.Visible
end)
1 Like

Are those lines of code inside of a LocalScript directly inside of the button that is being referenced by script.Parent? If you put the LocalScript into the frame, that function cannot be activated via MouseButton1Click.

1 Like

I found the problem. Try changing the text button to a image label and remove the image displayed, or you can do

script.Parent.add_shopping_cart.MouseButton1Click:Connect(function()
    --code
end)
2 Likes

Yes, they are placed inside the text button that you click to turn visibilty on and off

1 Like

If that doesn’t work substitute the add_shopping_cart for TextButton_Roundify_12px

2 Likes

You fixed it! Thanks, I can’t believe that was the problem! Thanks mate.

2 Likes