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

Tweening parts from point to point and "Unable to cast to Dictionary"?

Asked by 5 years ago

I'm trying to tween a part from point 1 to 2 and 2 to 3

In the Output it says "Unable to cast to Dictionary"

How do make it cast to Dictionary?

local tweenService = game:GetService("TweenService")
local part = script.Parent

local tweeningInformation = TweenInfo.new(

20,
Enum.EasingStyle.Linear,
Enum.EasingDirection.Out,
0,
false,
0
) 

    local Start = {CFrame.new(49.487, -0.13, 13.5)}
    local Mid = {CFrame.new(53.023, 3.406, 13.5)}
    local End = {CFrame.new(48.002, 8.426, 13.5)}


local TweenStart = tweenService:Create(part, tweeningInformation, Start)
local TweenMid = tweenService:Create(part, tweeningInformation, Mid)
local TweenEnd = tweenService:Create(part, tweeningInformation, End)

while true do
    TweenMid:Play()
    wait(10)
    TweenEndt:Play()
    wait(10)
    TweenStart:Play()
    wait(10)
end

1 answer

Log in to vote
0
Answered by
clc02 553 Moderation Voter
5 years ago
Edited 5 years ago

https://developer.roblox.com/api-reference/function/TweenService/Create

Start, Mid, and End need to be specially formatted. You need to set the key to the property being changed. So instead of

local Start = {CFrame.new(49.487, -0.13, 13.5)}

use

local Start = {CFrame = CFrame.new(49.487, -0.13, 13.5)}

The latter has an index of CFrame, the former had an index of 1.

0
Please use [text](url) for links User#5423 17 — 5y
Ad

Answer this question