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

"Unable to cast to dictionary" when trying to tween object? Why it happens?

Hello, devs!

I was writing script about tweening object. I had an error so I am posting it on scriptinghelpers. My error is "Unable to cast to dictionary".

CODE:

local tweenService = game:GetService("TweenService")

local part = script.Parent

local tweeningInfo = TweenInfo.new(
	5,
	Enum.EasingStyle.Linear,
	Enum.EasingDirection.Out,
	5,
	true,
	3
)

local PartPro = {
	Vector3.new(78.6, 4.4, -2.5)
}

local Tween = tweenService:Create(part, tweeningInfo, PartPro)
Tween:Play()

ERRORS:

Unable to cast to dictionary Line 18

1 answer

Hi, your Goal is incorrect.

local PartPro = {
    Vector3.new(78.6, 4.4, -2.5)
}

You must put "Size" before that (or the name of what property of a part you want to change) if you want to change it. Here's the fixed script:

local tweenService = game:GetService("TweenService")

local part = script.Parent

local tweeningInfo = TweenInfo.new(
    5,
    Enum.EasingStyle.Linear,
    Enum.EasingDirection.Out,
    5,
    true,
    3
)

local PartPro = {
    Size = Vector3.new(78.6, 4.4, -2.5) -- here
}

local Tween = tweenService:Create(part, tweeningInfo, PartPro)
Tween:Play()

Hope this helps

1 comment

0

its probally position

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