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

I'm trying to make a computer menu GUI button, why wont it work?

I'm trying to make a menu button so when you press a button the menu pops up, but it's not working...

local mainscreen = script.Parent.Parent.Parent.MainPart --Screensaver

local menu = script.Parent.Parent.Parent.Parent.StartMenu --Home Menu

local loading = script.Parent.Parent.Parent.Parent.Loader --Loading screen

local homebutton = script.Parent

homebutton.MouseButton1Down:connect(function()
	menu.MainPart.Visible = true
end)

I'm a bit of a noob so go easy on me!

2 comments

0

you probably have to create a picture of what those 4 parents are.

0

Those aren't images they are GUIs

1 answer

✓ Accepted answer

Here.

local function OnClicked ()
	local main = script.Parent.Parent.Parent.MainPart
	local menu = script.Parent.Parent.Parent.Parent.StartMenu
	local loading = script.Parent.Parent.Parent.Parent.Loader
	local homebutton = script.Parent
	
	menu.MainPart.Visible = true
	
end

script.Parent.MouseButton1Down:connect(OnClicked)

if u want to make the main part invisible if u click it again use this, this script also makes it so that u can only click it every 1 second.

local function OnClicked ()
	
	local db = 0 -- Sets Variable
	
	local hi = 0 -- Sets Variable
	
	if db == 0 then -- If the db is 0 then
		
	db = 1 -- sets db to 1
	
	if hi == 0 then  -- if hi is 0 then
		
		hi = 1 -- sets hi to 1
		
		local main = script.Parent.Parent.Parent.MainPart
		local menu = script.Parent.Parent.Parent.Parent.StartMenu
		local loading = script.Parent.Parent.Parent.Parent.Loader
		local homebutton = script.Parent
	
		menu.MainPart.Visible = true
		
	else  -- if hi is not 1 then
		
		local main = script.Parent.Parent.Parent.MainPart
		local menu = script.Parent.Parent.Parent.Parent.StartMenu
		local loading = script.Parent.Parent.Parent.Parent.Loader
		local homebutton = script.Parent
		
		hi = 0 -- sets hi to 0
		
		menu.MainPart.Visible = false
	
	end
	
	wait(1) -- waits 1 seconds before u can click the button again
	
	db = 0 -- sets db to 0 so you can click the button again
	else return end  -- if db is 1 then it ends
end

script.Parent.MouseButton1Down:connect(OnClicked)

2 comments

0

Thanks!

0

np

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