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

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

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

✓ Accepted answer

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.

1 comment

0

Please use text for links

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