Having trouble with this! This script might have a lot of errors:
Opening button:
01 | function onClicked() |
02 | local open = script.Parent.Parent |
03 | local close = script.Parent.Parent |
04 | open.Visible = true |
05 | if script.Parent.Parent.Visible = = true then |
06 | print = ( "Opened" ) |
07 | end |
08 | end |
09 |
10 | script.Parent.MouseButton 1 Click:connect(onClicked) |
Closing Button:
01 | function onClicked() |
02 | local open = script.Parent.Parent |
03 | local close = script.Parent.Parent |
04 | close.Visible = false |
05 | if script.Parent.Parent.Visible = = false then |
06 | print = ( "Closed" ) |
07 | end |
08 | end |
09 |
10 | script.Parent.MouseButton 1 Click:connect(onClicked) |
To start off please fully detail the assets of your GUI
For what i see you're doubling the variable. You're also using it without sense. If a function is the make something true then whatever comes when it is true should be included in the function. Finally, if both functions have one name then the script would break. So use it in separate names. Use it like this:
01 | local open = script.Parent.Parent |
02 |
03 | function Open() |
04 | open.Visible = true |
05 | print = ( "Opened" ) |
06 | end |
07 |
08 | function Close() |
09 | open.Visible = false |
10 | print = ( "Closed" ) |
11 | end |
12 |
13 | function Connect() |
14 | if open.Visible = = true then |
15 | Open() |
Open Script
01 | local Button = script.Parent |
02 | Frame = script.Parent.Parent.Front --This is a example |
03 |
04 |
05 | function onClick() |
06 |
07 | Frame.Visible = true -- make sure it says true if you want it to open |
08 |
09 | end |
10 |
11 |
12 | Button.MouseButton 1 Click:connect(onClick) |
Close Script
01 | local Button = script.Parent |
02 | Frame = script.Parent.Parent.Menu -- this is just a example |
03 |
04 |
05 |
06 | function onClick() |
07 |
08 |
09 | Frame.Visible = false --leave it false if you want it to close |
10 |
11 |
12 | end |
13 |
14 | Button.MouseButton 1 Down:connect(onClick) |