that’s why I normaly use this toggle function here:
script.Parent.MouseButton1Click:Connect(function()
if script.Parent.Parent.MainFrame.Visible == true then
script.Parent.Parent.MainFrame.Visible = false
else
script.Parent.Parent.MainFrame.Visible = true
end
end)
Toggle switchers should not be used like that. The script.Parent.Visible = not Script.Parent.Visible is better because its more simple and would run faster: because less code
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.
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.
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.
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
Ahh, I see… Sorry for the late reply 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
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)
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)
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.