Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

GUI not visible even when Visible is true? [closed]

Asked by 3 years ago

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.

0
If you are changing the visibility property, are you doing it through the player's PlayerGui or StarterGui? DeUltimate23 142 — 3y
0
StarterGui lemony_dev 9 — 3y
0
(I think) lemony_dev 9 — 3y

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?

2 answers

Log in to vote
0
Answered by 3 years ago

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)
0
doesnt work, heres my code lemony_dev 9 — 3y
0
??????? forgot to actually paste it: local player = game.Players.LocalPlayer local shop = player.PlayerGui.shopGui.Frame shop.MouseButton1Click:Connect(function() if shop.visible == false then shop.Visible = true else shop.Visible = false end end) lemony_dev 9 — 3y
Ad
Log in to vote
0
Answered by 3 years ago
Edited 3 years ago

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)