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

Why isn't the TweenPosition function working like it should in my script?

Asked by 8 years ago

I am trying to make a box fly onto the screen with tween position.

I have recently run into an error that has puzzled me for quite some time now and after multiple attempts to fix my script, I decided to ask you guys on scripting helpers why my script isn't working the way it should.

Here is my script,

script.Parent.Position = UDim2.new(0.25,0,1,0)
script.Parent:TweenPosition(UDim2.new(0.25,0,.25,0), "Quint", "In", 2)

As you can see, this script is a child of the object I want to animate, a frame, but instead of it working I get this error,

20:21:09.874 - Unable to cast string to token
20:21:09.875 - Stack Begin
20:21:09.876 - Script 'Players.Player1.PlayerGui.MACROS.login.box.Starter', Line 2
20:21:09.877 - Stack End

I can't seem to figure out what this error message means so I am in need of help. Thanks.

1 answer

Log in to vote
0
Answered by 8 years ago

It's because you messed up on the EasingStyle and Direction. They aren't strings, they're values. Also, you put the Style parameter before the Direction parameter. It's the other way around.

script.Parent.Position = UDim2.new(0.25, 0 ,1 , 0)
script.Parent:TweenPosition(UDim2.new(0.25,0,.25,0), Enum.EasingDirection.In,  Enum.EasingStyle.Quint, 2)

This works.

Remember to accept the answer if it helped :)

0
Thanks! I can continue on my GUI project. :) creeper1164 17 — 8y
0
No prob :D DepressionSensei 315 — 8y
Ad

Answer this question