✓ Accepted answer
TweenPosition is a function of GuiObject, not a property. Functions are executed like so:
Frame:FUNCTIONNAME(Parameters)
Also, you need to make sure to include all necessary parameters! Please reference the wiki.
local Button = script.Parent
Frame = script.Parent.Parent
Button.MouseButton1Click:connect(function(close)
if Frame.Visible == true then
Frame:TweenPosition(UDim2.new(0,100,0,300),"Out", "Quad", 1, true)
end
end)
Edit "Quad" is the EasingStyle. The EasingStyle controls how fast it goes at any given point. The EasingStyle Linear makes it go the same pace the whole time, Sine starts fast and slows the closer it gets to the destination. Here are a bunch of graphs showing the equations for each combination of EasingStyle and "In", "Out", or "InOut".
The 1 is the float time, or in other words the amount of time it takes to Tween the object.
The last boolean at the end is for whether or not this tween can be interrupted by another Tween. Right now it is at true, so you could start another Tween on this frame and it would override the current one being run. If it was false, the new Tween wouldn't run.
3 comments
Thank you, I referred to the Wiki after I posted this, and I was hoping for an explanation, but what you've given me is alright, I've figured it out now. Thank you for your time.
If you have any questions about TweenPosition, I can answer them.
There was one thing I couldn't find on the wiki, but why do you add "Quad, "1", true at the end?