generic image
Processing...
  • Games
  • Catalog
  • Develop
  • Robux
  • Search in Players
  • Search in Games
  • Search in Catalog
  • Search in Groups
  • Search in Library
  • Log In
  • Sign Up
  • Games
  • Catalog
  • Develop
  • Robux
   
ROBLOX Forum » Game Creation and Development » Scripters
Home Search
 

Re: TweenPosition (OnClicked)

Previous Thread :: Next Thread 
modecom2 is not online. 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 is not online. 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 is not online. 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 is not online. 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 is not online. 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 is not online. 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 is not online. 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
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripters
   
 
   
  • About Us
  • Jobs
  • Blog
  • Parents
  • Help
  • Terms
  • Privacy

©2017 Roblox Corporation. Roblox, the Roblox logo, Robux, Bloxy, and Powering Imagination are among our registered and unregistered trademarks in the U.S. and other countries.



Progress
Starting Roblox...
Connecting to Players...
R R

Roblox is now loading. Get ready to play!

R R

You're moments away from getting into the game!

Click here for help

Check Remember my choice and click Launch Application in the dialog box above to join games faster in the future!

Gameplay sponsored by:
Loading 0% - Starting game...
Get more with Builders Club! Join Builders Club
Choose Your Avatar
I have an account
generic image