Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

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

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 comment

1

Could you post the entirety of the script?

3 answers

✓ Accepted answer

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.

1 comment

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.

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

1 comment

0

and make suure to accept awnswers!

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

1 comment

0

Still not working :/

This discussion is preserved as it was. New answers, comments, and votes are closed.