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

Why wont this local script work?

I am trying to make a GUI that closes and opens. I am inserting this into the actual button, which would toggle it. It looks like this: >Frame TextLabel > Buttons frame > Button Local script All of this is inside of a Screen GUI. If you don't understand the diagram above, please tell me and I will explain it! Also should the Screen GUI be visible when the player joins, or not?

` local frame = script.Parent.Parent:WaitForChild('Frame') script.Parent.MouseButton1Click:connect(function() frame.Visible = not frame.Visible

end)`

1 comment

0

frame.Visible and after is its own line..sorry!(Minus the space and end)

1 answer

✓ Accepted answer

MouseButton1Click is usually used with Scripts. MouseButton1Down, however, is used for LocalScripts. Just change the two and it should work.

local frame=script.Parent.Parent:WaitForChild("Frame")

script.Parent.MouseButton1Down:connect(function()
	frame.Visible=not frame.Visible.
end)

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