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

My open/close tab doesn't work, what can be done to fix it?

I tried to script a button that will open and close a frame but despite the ScreenGUI frames appear on the screen, the button won't function (open and close on click)

local Button = script.Parent.AddAssignment.CloseFrame.CloseButton

Frame = script.Parent.AddAssignment.Frame

function onClick()
	if Frame.Visible == false then
		Frame.Visible = true
	elseif Frame.Visible == true then
		Frame.Visible = false
		
	end
end

Button.MouseButton1Click.connect(onClick)

Note: All the objects above exist in the workspace

1 comment

1

Frame.Visible = not Frame.Visible will do the same thing as your if's

1 answer

Connections to events are denoted with a : colon, not a . period.

Therefore, your connection line should be:

Button.MouseButton1Click:connect(onClick)

Event Triggered Functions

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