Hey everyone, this is my first community tutorial and I can’t wait to show you it, I am going to show you how to tween your GUI to make it go in and out with a smooth movement!
First of all do what is in the image above and customize the UI to how you want!
Next in the “Local Script” which is in your Open button, copy out the script below.
I would recommend opening a notepad and typing the position of your Frame now which you can find by going into the properties of your Frame and finding “Position”, then copy what it says there and paste it into your notepad.
After that move your Frame to where you want it to come from when you click the open button, then copy the position of your Frame when it is there and paste it in your notepad again.
I put mine to the side of my screen because that’s where I want it to come from when I open it.
After that copy out the script below. Put this script in the Local Script in the Open button.
-- Where it says "Position", put the position of your Frame when it is open, also remove the "{}" or it won't work
local Frame = script.Parent.Parent.Frame
script.Parent.MouseButton1Click:Connect(function()
Frame:TweenPosition(UDim2.new(Position))
end)
Next go into your Local Script in the Close button and type he following:
-- Where it says "Position", put the position of your Frame when it is open, also remove the "{}" or it won't work
local Frame = script.Parent.Parent
script.Parent.MouseButton1Click:Connect(function()
Frame:TweenPosition(UDim2.new(Position))
end)
Now go into your game and test it out by clicking the open button.
If this does not work, please reply to this post saying it doesn’t so I can fix it, although it should work since I have tested it myself.