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

Why does my GUI Button Tween to a broken position instead of the wanted one?

So I want to make a simple animation but this button just doesn't cooperate.

The start screen: https://gyazo.com/34be4d4f575862700b001f0ddccf4b27

The start position of a button is: {0.5, -138},{0.6, -34}

Then the position the button should be after tweening: https://gyazo.com/568e9211b8bcb6b4f427f151b7992645

The position of it would be: {0.5, -138},{0.8, -34}

But it goes here: https://gyazo.com/6cef9c3128e3d4ba74edb55aa0f4f0a8

But the position is still: {0.5, -138},{0.8, -34}

The tween script of it is:

local Play = script.Parent.Main.Play
local PlayStop =0.5, -138,0.8, -34
	
	Play.Visible = true
	Play:TweenPosition(UDim2.new(PlayStop), 'Out', 1)

Why does this happen?

2 answers

✓ Accepted answer

The first argument of a TweenPosition must be a UDim2 value, and not 4 seperate values. It also requires an EasingDirection, and an EasingStyle.

local Play = script.Parent.Main.Play
local PlayStop =UDim2.new(0.5, -138,0.8, -34)
Play.Visible = true
Play:TweenPosition(PlayStop, Enum.EasingDirection.Out, Enum.EasingStyle.Sine, 1, false)
--EndPosition, Direction, Style, Time, Override

6 comments

0

upvote if it helpt ty

0

Sine is not a valid EnumItem

0

aw crap, sorry, I meant to do Enum.EasingStyle.Sine--i make this mistake all the time

0

fix'd it

0

Thank you!

0

you're welcome

I'm not exactly sure, but try this:

local Play = script.Parent.Main.Play
local PlayStop =0.5, -138,0.8, -34
	 
Play.Visible = true
Play:TweenPosition(UDim2.new(PlayStop), 'In', 1)

1 comment

0

The only thing you did is chage Out to In and it didn't change anything.

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