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

Setting a .visible for a GUI is not working, how do I do it?

Asked by
thezube 10
7 years ago

I'm trying to create a store GUI and I really need the .visible to work.

MainBack.HatsButton.MouseButton1Down:connect(function()
MainBack.Visible = false
Hats.Visible = true 

When I click the button (ImageButton) it doesn't do anything. It is very essential that it works.

1
Could you post the entirety of the script? nicemike40 486 — 7y

3 answers

Log in to vote
0
Answered by 7 years ago
Edited 7 years ago

Fixed Code:

local Store = game.StarterGui.Store
 -- Don't use parent just put the gui in StarterGUI
local MainBack = Store.MainBack
local Trails = Store.Trails
local Hats = Store.Hats
local Guns = Store.Guns

MainBack.HatsButton.MouseButton1Click:connect(function() -- Use MouseButton1Click
MainBack.Visible = false
Hats.Visible = true 

end)

If i'm correct this would work, if it does please accept this answer.

0
This would not work though, as you are changing the visibility in StarterGui, meaning anyone who joins the game now sees the new visibility. FrostTaco 90 — 7y
Ad
Log in to vote
0
Answered by 7 years ago

First, THIS IS A LOCAL SCRIPT DO NOT USE A REGULAR SCRIPT. Second, we need to see your variables! Here is a example, and make HatsButton a TextButton

local debounce = false
local MainBack = game.Players.LocalPlayer.StarterGui
function Open()
    if debounce = false then --Means this will not run multiple times at once, as it is not nessasary.
        local debounce = true
        MainBack.Visible = false
        Hats.Visible = true
        local debounce = false --makes the function usable again now
    end
end

MainBack.HatsButton.MouseButton1Click:connect(Open) --does the function we just made
0
and make suure to accept awnswers! SH_Helper 61 — 7y
Log in to vote
-1
Answered by
thezube 10
7 years ago

Sure,

--Start of shop script
local Store = game.StarterGui.Store
Store.Parent = PlayerGui
local MainBack = Store.MainBack
local Trails = Store.Trails
local Hats = Store.Hats
local Guns = Store.Guns

MainBack.HatsButton.MouseButton1Down:connect(function()
MainBack.Visible = false
Hats.Visible = true 

end)

Here is an image also: https://gyazo.com/2af0ab4813db4c39d7c94f59812783c8

0
Still not working :/ thezube 10 — 7y

Answer this question