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

Exit button GUI won't dissappear in lobby?

Hello everyone! i'm making a sort of Camping like game and whilst in the lobby i have 2 cars and a button which reads exit. i dont want the button to be there until i am in the car itself. my script doesnt work and the exit button stays and dissapears once u click it so u cant use it afterwards again. help please? thank you!

local frame = script.Parent.Parent.Parent.Frame
local open = false

script.Parent.MouseButton1Click:Connect(function()
	if frame.Visible == false then
		frame.Visible = false
	else
		frame.Visible = false
	end
end)

5 comments

0

Lines 5-9 can be replaced with frame.Visible = false alone. What do you want?

0

in line 5, make it true not false

0

@programmerHere, i dont quite understand what you mean. im trying to have it not pop up on screen until i access the certain area.

0

@Gingerely, tried that. It still showed up when i joined.

0

I understand i might have to go in depth a little, i'm trying to make it so that the exit button (the gui) pops up as soon as the player enters the vehicle allowing him to get out of the vehicle. but i dont want the gui to be on screen whilst the player isn't in the vehicle.

1 answer

Make sure you are using a local script. Also, the reason why it’s not working is cause you need to change false to true on line 6. Here’s a working script.


local frame = script.Parent.Parent.Parent.Frame
local open = false

script.Parent.MouseButton1Click:Connect(function()
    if frame.Visible == false then
        frame.Visible = true
    else
        frame.Visible = false
    end
end)

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