Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

How may i do this better?

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

✓ Accepted answer

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.

1 comment

0

Thnaks again magic beard...

This discussion is preserved as it was. New answers, comments, and votes are closed.