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

How to fix “Unable to cast to Dictionary” when tweening?

Just getting back into scripting and while trying to make a “shakingt” tween i keep receiving Unable to cast to Dictionary in output.

local TS = game:GetService(“TweenService”)
local Part = script.Parent
print (“starting shake”)
local TI = TweenInfo.new(1,Enum.EasingStyle.Bounce,Enum.EasingDirection.Out,20,true,1.5)

local Pos = Part.CFrame

local NewPos = Pos*CFrame.new(0,-3,-3)

local T = TS:Create(Part,TI,NewPos)

T:Play()
print(“shaking”)

`

2 answers

✓ Accepted answer

The Part Properties has to be a table. You also don't have to saw Part.CFrame, just say CFrame as the part is referenced in the tween.

You need to put the properties as a Dictionary/table: Example Script

local TS = game:GetService(“TweenService”)
local Part = script.Parent
print (“starting shake”)
local TI = TweenInfo.new(1,Enum.EasingStyle.Bounce,Enum.EasingDirection.Out,20,true,1.5)

local Pos = Part.CFrame

local props = {
CFrame = Pos*CFrame.new(0,-3,-3)
} -- a dictionary for the table of properties

local T = TS:Create(Part,TI,props)

T:Play()
print(“shaking”)

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