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

Im trying to find an open/close for my starter GUI?

Im trying to find an open/close script for my start gui, but they all seem to not work or are scripted in a way a cant edit. Im not sure if im suppost to use a frame with the 3 text buttons i have in this ui but all the scripts ive been looking at or finding have been scripted that way. Im just looking for a simple fix.

Ignore the weird question mark in the title for some reason it had to be there.

1 answer

Welp, you can't really ask for requests here but sure i'll show you, this doesn't use any scripting knowledge, it's just a smart setup only using variables. Now obviously your gui is gonna have a button, either a text button or an image button, im not sure how you set it up so you may wanna do some changes in your script, we are going to use a local script since all ui objects are local,

local frame = script.Parent.Parent -- this is your main ui that is a parent of all other uis
local button = script.Parent -- or wherever your button is
local open = false -- this var that is storing a boolean value is gonna determind if our gui is open or closed, you wanna set it to false by default since your ui is gnna be closed at first

button.MouseButton1Click:Connect(function() --this is the event that were gonna use, it fires when the ui is clicked
	if open == false then
		open = true
		frame.Visible = true
	else
		open = false
		frame.Visible = false
	end
end)
	
		

and that's really it, the Visible propety isprety much self explainbale, if its false local player wont see the ui, if its true he does.

I notice that you have no knowledge of scripting, and that's relly bad to just always ask others to make them stuff, start learning!

7 comments

0

you can not just use frame.Visible = not frame.Visible ? and you can only use button.Actived

0

what? did i do anything wrong

0

No, but it would be much simpler to use this, using this you dont need variable. if you want to make this only change the open/close to frame.Visible = not frame.Visible and on button.MouseButton1Click change to button.Actived (you dont need to use this, only if you like)

0

yah button.Activated is a thing, but idk 99% people use the MouseButton1Click event

0

oh ok, you might be right, i use this since i started scripting, ty for telling me!

0

button.Actived does the same thing literally

0

yahyah ik now

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