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

My hide gui button isn't working! Ive tried a lot so I've came here. How do u fix it?

its a Jojo's poses type game. like an add-on for yt videos. im not the best at Lua so tell me what I've done wrong cuz the script isn't working. here's the script:

local CloseButton = game.StarterGui.CloseGui.Closebutton

if CloseButton mouseButton.clicked1
then
	game.StarterGui.MainGui
	Visible = 0
end

2 answers

local CloseButton = game.StarterGui.CloseGui.Closebutton

CloseButton.MouseButton1Click:connect(function()
(path to the GUI, example: script.Parent.Parent).Visible = False

This is mine if you wanna change it up

script.Parent.MouseButton1Click:connect(function()
	script.Parent.Parent.Visible = false
end)

this basically just closes the gui it is in

1 comment

0

doesn't work

local CloseButton = game.StarterGui.CloseGui.Closebutton

CloseButton.MouseButtonClick:Connect(function()
    game.StarterGui.MainGui.Visible = false
end

MouseButton.Clicked1 does not exist as a function nor an event and don't use then after a MouseButton detection event, do

CloseButton.MouseButton1Click:Connect(function()
	--Code here....

, not

if CloseButton mouseButton.clicked1
	then
		--Code here, but its the wrong usage

and Visible is a property of a GUI, and its a BoolValue(it has 2 states, true or false) it is not an integer to determine which it is

1 comment

0

like the other guy's it doesn't work

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