Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How may i do this better?

Asked by
Xianon 105
8 years ago

It all works, if i put a print it will output like theres no error, my only problem it's that TweenPosition isn't having any effect on my TextButton...

local settings = script.Parent
local graphics_q = script.Parent.Parent.Graphics_Q
settings.MouseButton1Click:connect(function()
    graphics_q:TweenPosition(UDim2.new(120, 0, 0, 0))

end)

1 answer

Log in to vote
2
Answered by 8 years ago

The TweenPosition function has multiple parameters (variables you put in the parenthesis)

This is how you would do a correct tween (implying you want a linear tween over 2 seconds)

local settings = script.Parent
local graphics_q = script.Parent.Parent.Graphics_Q
settings.MouseButton1Click:connect(function()
    graphics_q:TweenPosition(UDim2.new(120, 0, 0, 0), "Out", "Linear", 2)
end)

The first parameter is a new position you want to tween to, the next one is either "In", "Out", or "InOut", this is setting the EasingDirection, next is the EasingStyle, the third is the time it takes for the tweening to complete. There is also an optional fourth boolean you can put (true or false) that will allow you to "override" the function and stop it to do a separate tween.

0
Thnaks again magic beard... Xianon 105 — 8y
Ad

Answer this question