Unable to cast to Dictionary

I’m currently in Roblox Studio, trying to simply move a TextLabel across the X axis, via TweenService.
However, I get an “Unable to cast to Dictionary” error, and I’m unsure what I did wrong.
Please keep this in mind; I’m very new to scripting as a whole, so people try to tolerate my confusion and for the probably several mistakes in my code.


local TweenService = game:GetService("TweenService")

local TL = script.Parent.Frame.TextLabel

local tweenInfo = TweenInfo.new(1, Enum.EasingStyle.Linear,Enum.EasingDirection.Out)

local tween1 = {TL.Position.X.Offset * 10}

local Tween = TweenService:Create(TL,tweenInfo,tween1)

I would appreciate any constructive feedback, help or advice, thanks.

Its supposed to be:

local tween1 = {["PropertyNameToChange"] = TL.Position.X.Offset * 10}

when using the tween service the third argument must be the thing you want to tween like size and color for example.

Replace this

with this:
local tween1 = {Position = TL.Position.X.Offset * 10}

I believe you want to use TweenPosition for Gui Objects.

Thank you for your response,
I tried your fix, however I got the following error;
TweenService:Create property named 'Position' cannot be tweened due to type mismatch (property is a 'UDim2', but given type is 'double')

Excuse me I forgot that what you want to tween is a gui try this instead:
local tween1 = {Position = UDim2.fromOffset(TL.Position.X.Offset * 10,TL.Position.Y.Offset)}

Well on the bright side, there are no errors in the output, however, the TextLabel referred to in the script, for some reason doesn’t move.

Use this Code:

local TL = script.Parent.Frame.TextLabel

local tween1 = UDim2.fromOffset(TL.Position.X.Offset*10,TL.Position.Y.Offset)

local Tween = TL:TweenPosition(










I’ve tested it in studio and it works just fine.

EDIT: not sure why the preformatted text didn’t work… just right-click and “Format” the entire document.

This worked nicely, thank you!

However I would like to ask, for learning purposes, what was different in your code than in mines, that caused it to work? I’m sorry to have to ask you that, but as said in the post, I’m a very amateur/new scripter, therefore I am looking to gain whatever knowledge on in that I can.

I’m not 100% with this, but I believe you’re supposed to use the TweenPosition in favor of the other method, which to my knowledge, is just used for tweening models and parts.

But as I said, I’m not 100% with this. So, it’d be best that you read around the DevForum and Roblox API.

You can’t individually assign to the X scale/offset or Y scale/offset components of a UDim2 value assigned to a GuiObject’s Size/Position property, you instead need to assign a newly constructed UDim2 value.

local tween1 = {Position = UDim2.new(TL.Position.X.Scale, TL.Position.X.Offset * 10, TL.Position.Y.Scale, TL.Position.Y.Offset)}