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

Unable to cast token to float?

This is my first time really messing around with GUIs and how to tween them, I managed to tween the transparency of the GUI using the Roblox TweenService, however when I try to use :TweenPosition(), I just the error "Unable to cast token to float."

NewFrame.TextLabel:TweenPosition(NewFrame.TextLabel, UDim2.new(1.27, 0,0, .25), Enum.EasingDirection.In,Enum.EasingStyle.Linear , 5)

Any help would be appreciated.

1 answer

✓ Accepted answer

change it to

NewFrame.TextLabel:TweenPosition(UDim2.new(1.27, 0,0, .25), Enum.EasingDirection.In,Enum.EasingStyle.Linear , 5)

When you are calling method with :, self argument is automatically passed (self refers to the object that called it) so the function already knows who to tween size of, the UI that called it, there is no need to pass it manually, if you wish to do that tho, replace colon with dot and it should work

NewFrame.TextLabel.TweenPosition(NewFrame.TextLabel, UDim2.new(1.27, 0,0, .25), Enum.EasingDirection.In,Enum.EasingStyle.Linear , 5)

It is however pointless, same as doing

workspace.GetChildren(workspace)

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