I’m making a shop button that: If the shop is open, it closes the shop when you click it, and vice versa. But the issue is when I click it the Visible property gets checked but the GUI doesn’t show.
If you happen to be changing the visibility property through StarterGui, then it is a pretty common mistake. Whenever you run your game, all the content in StarterGui gets replicated and put into the player's PlayerGui. So for instance if you wanted to change a certain property of a GUI while the game is still running, you would have to change it via PlayerGui, but this is just the case if you do not put your local scripts inside the certain GUI's.
EXAMPLE:
local player = game.Players.LocalPlayer local myButton = player.PlayerGui.ScreenGui.TextButton myButton.MouseButton1Click:Connect(function() --Something happens when clicked-- end)
Here is an example of what you could do using a local script in StarterGui
--Open script This will of course need the UI under properties Visible to false
local myButton = script.Parent.TextButton local Frame = script.Parent.Parent.Frame myButton.MouseButton1Click:Connect(function() Frame.Visible = true end)
--Close Script This will of course need the UI under properties Visible to true
local myButton = script.Parent.TextButton local Frame = script.Parent.Parent.Frame myButton.MouseButton1Click:Connect(function() Frame.Visible = false end)
Closed as Non-Descriptive by DeceptiveCaster
This question has been closed because its title or content does not adequately describe the problem you are trying to solve.
Please ensure that your question pertains to your actual problem, rather than your attempted solution. That is, you were trying to solve problem X, and you thought solution Y would work, but instead of asking about X when you ran into trouble, you asked about Y.
Why was this question closed?