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

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

Asked by
Lualaxy 78
5 years ago

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

Log in to vote
1
Answered by
Fifkee 2017 Community Moderator Moderation Voter
5 years ago
Edited 5 years ago

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
0
upvote if it helpt ty Fifkee 2017 — 5y
0
Sine is not a valid EnumItem Lualaxy 78 — 5y
0
aw crap, sorry, I meant to do Enum.EasingStyle.Sine--i make this mistake all the time Fifkee 2017 — 5y
0
fix'd it Fifkee 2017 — 5y
View all comments (2 more)
0
Thank you! Lualaxy 78 — 5y
0
you're welcome Fifkee 2017 — 5y
Ad
Log in to vote
0
Answered by 5 years ago
Edited 5 years ago

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)
0
The only thing you did is chage Out to In and it didn't change anything. Lualaxy 78 — 5y

Answer this question