modecom2
|
  |
| Joined: 18 Jul 2009 |
| Total Posts: 114 |
|
|
| 02 Nov 2015 08:19 AM |
I am trying to make an onClicked slide in GUI. I have a Textbutton and a frame that i want to slide out of the screen when i press the button.
I am new to scripting :( But i want help to make this script work properly... It may look really terribly weird but here is what i got so far:
function onButtonClicked () script.Parent.Parent.ShopFrame:TweenPosition(UDim2.new(0,-5,0.305),"InOut","Quad", 1) wait(0.5) script.Parent.Parent.ShopFrame:TweenPosition(UDim2.new(0,20,0.305),"InOut","Quad", 1) end script.Parent.MouseButton1Click:connect(onButtonClicked)
So when the Frame of the GUI slided out there is a Close button inside the frame and i want to make it slide away when the Close button is pressed... how do i do it? Any links for how to do it or something?
~~Modecom2 |
|
|
| Report Abuse |
|
|
vlekje513
|
  |
| Joined: 28 Dec 2010 |
| Total Posts: 9057 |
|
|
| 02 Nov 2015 08:24 AM |
function onButtonClicked () script.Parent.Parent.ShopFrame:TweenPosition(UDim2.new(0,-5,0.305,0),"InOut","Quad", 1) wait(0.5) script.Parent.Parent.ShopFrame:TweenPosition(UDim2.new(0,20,0.305,0),"InOut","Quad", 1) end script.Parent.MouseButton1Click:connect(onButtonClicked)
|
|
|
| Report Abuse |
|
|
modecom2
|
  |
| Joined: 18 Jul 2009 |
| Total Posts: 114 |
|
|
| 02 Nov 2015 08:29 AM |
I want to make it go both ways ... There are Open and Close buttons: Open is to make it slide out of the screen Close to make it slide away off the screen...
I want this script to be modified. So it can work properly. Like i mentioned above. |
|
|
| Report Abuse |
|
|
vlekje513
|
  |
| Joined: 28 Dec 2010 |
| Total Posts: 9057 |
|
|
| 02 Nov 2015 08:38 AM |
local Closed = true
function onButtonClicked () if Closed then script.Parent.Parent.ShopFrame:TweenPosition(UDim2.new(0,20,0.305),"InOut","Quad", 1) else script.Parent.Parent.ShopFrame:TweenPosition(UDim2.new(0,-5,0.305),"InOut","Quad", 1 end end script.Parent.MouseButton1Click:connect(onButtonClicked) |
|
|
| Report Abuse |
|
|
Locard
|
  |
| Joined: 13 Apr 2014 |
| Total Posts: 3516 |
|
|
| 02 Nov 2015 11:44 AM |
| Put ,true after 1 so that the next tween can override the first one. |
|
|
| Report Abuse |
|
|
modecom2
|
  |
| Joined: 18 Jul 2009 |
| Total Posts: 114 |
|
|
| 02 Nov 2015 01:46 PM |
Ok, So the Open Shop is working i made as you told me:
function onButtonClicked () script.Parent.Parent.ShopFrame:TweenPosition(UDim2.new(0,-5,0.305,0),"InOut","Quad", 1,true) wait(0.5) script.Parent.Parent.ShopFrame:TweenPosition(UDim2.new(0,20,0.305,0),"InOut","Quad", 1,true) end script.Parent.MouseButton1Click:connect(onButtonClicked)
Now i need the Close Shop script.. so there will be 2 scripts as the Close button is a second TextButton inside the frame that opens. I copied the script to the Close button but it doesn't work ... |
|
|
| Report Abuse |
|
|
modecom2
|
  |
| Joined: 18 Jul 2009 |
| Total Posts: 114 |
|
|
| 02 Nov 2015 01:48 PM |
Oops sorry i mean i made this:
local Closed = true
function onButtonClicked () if Closed then script.Parent.Parent.ShopFrame:TweenPosition(UDim2.new(0,20,0.305),"InOut","Quad", 1,true) else script.Parent.Parent.ShopFrame:TweenPosition(UDim2.new(0,-5,0.305),"InOut","Quad", 1,true) end end script.Parent.MouseButton1Click:connect(onButtonClicked) |
|
|
| Report Abuse |
|
|