TweenPosition keeps returning "Unable to cast token to token"

Issue
I want to tween an image label inside a module script. The basics; however output keeps printing " [Unable to cast token to token]"

Here’s my script

function module.movefly(fly, info)

local ud = UDim2.new(UDim.new(tonumber(GUI["Fly"..fly].Position.X.Scale),0),0,0)

print(ud)

print(typeof(ud))

print(GUI["Fly"..fly].Position.X.Scale)

if Values[fly] == 3 then
Values[fly] = 2
t:Create(script.Parent["Fly"..fly].Value, info, {Value = script.Parent["Fly"..fly]:GetPrimaryPartCFrame() * CFrame.new(0,50,0)}):Play()
GUI["Fly"..fly]:TweenPosition(ud, info.EasingStyle, info.EasingDirection, info.Time)
wait(info.Time)
Values[fly] = 1
end
end

Output
[{0, 0}, {0, 0}]
[0]
[15:18:07.562 - Unable to cast token to token]

Now this isn’t my first version of the script, I’ve been changing it to try different ways.
What the script here does is tween a model (through a CFrameValue) and tween the image indicator showing where it is on a surface gui.

6 Likes

Could you put your code in the Lua format so its easier to see?

2 Likes

That means that one of the parameters are incorrect. Can you show your info array?

Edit:
Switch the places of info.EasingStyle and info.EasingDirection

2 Likes

It seems you’ve got parameters the wrong way round between EasingStyles and EasingDirection

GUI["Fly"..fly]:TweenPosition(ud,  info.EasingStyle, info.EasingDirection, info.Time)
wait(info.Time)
19 Likes

Thank you very much!

2 Likes

Yeah, it’s a little confusing because TweenSize and TweenPosition take the direction first and then the style while TweenInfo takes the style first then the direction.

7 Likes