When I press the TextButton it keeps printing out "opened" and "closed"
It also only allows me to open it, and the text of the text button does not change either.
01 | local button = script.Parent -- the text button you have to press to reposition the frame |
02 | local frame = script.Parent.Parent -- the frame that I wish to move |
03 | local isopen = false |
04 | repeat wait() until button |
05 |
06 | button.MouseButton 1 Down:connect( function () |
07 | if isopen = = false then |
08 | button.Text = "<" -- make the button text that you press change |
09 | frame:TweenPosition(UDim 2. new( 0 , 0 , . 3 , 0 ), 1 , "Bounce" , . 5 ) -- "opening" |
10 | isopen = true -- make open == true since the gui has moved positions |
11 | print ( "opened" ) |
12 | end |
13 |
14 | if isopen = = true then |
15 | button.Text = ">" -- make the button text that you pressed change |
16 | frame:TweenPosition(UDim 2. new( 0 , - 220 , . 3 , 0 ), 1 , "Bounce" , . 5 ) -- closing |
17 | isopen = false -- make open == false because the gui is now out of the screen |
18 | print ( "closed" ) |
19 | end |
20 | end ) |
01 | local button = script.Parent -- the text button you have to press to reposition the frame |
02 | local frame = script.Parent.Parent -- the frame that I wish to move |
03 | local isopen = false |
04 | repeat wait() until button |
05 | button.MouseButton 1 Down:connect( function () |
06 | if isopen = = false then |
07 | button.Text = "<" -- make the button text that you press change |
08 | frame:TweenPosition(UDim 2. new( 0 , 0 , . 3 , 0 ), 1 , "Bounce" , . 5 ) -- "opening" |
09 | isopen = true -- make open == true since the gui has moved positions |
10 | print ( "opened" ) |
11 | return |
12 | end |
13 | if isopen = = true then |
14 | button.Text = ">" -- make the button text that you pressed change |
15 | frame:TweenPosition(UDim 2. new( 0 , - 220 , . 3 , 0 ), 1 , "Bounce" , . 5 ) -- closing |
16 | isopen = false -- make open == false because the gui is now out of the screen |
17 | print ( "closed" ) |
18 | return |
19 | end |
20 | end ) |
Or
01 | local button = script.Parent -- the text button you have to press to reposition the frame |
02 | local frame = script.Parent.Parent -- the frame that I wish to move |
03 | local isopen = false |
04 | repeat wait() until button |
05 | button.MouseButton 1 Down:connect( function () |
06 | dbounce = false |
07 | if isopen = = false and not dbounce then |
08 | button.Text = "<" -- make the button text that you press change |
09 | frame:TweenPosition(UDim 2. new( 0 , 0 , . 3 , 0 ), 1 , "Bounce" , . 5 ) -- "opening" |
10 | isopen = true -- make open == true since the gui has moved positions |
11 | print ( "opened" ) |
12 | dbounce = true |
13 | end |
14 | if isopen = = true and not dbounce then |
15 | button.Text = ">" -- make the button text that you pressed change |
Basicly it was closing it, then following on with the code causing it to run the isopen function, i got stuck on this years ago, Its not professional to use dbounce values but if the return doesnt work thats my only way around.