I was simply trying to make a model rotate every 5 secs, but when I started the game, there was an issue in line 18 (the one creating the tween) while the output was “Unable to cast to Dictionary”. From what I learned, this message should appear when trying to put more than 3 arguments there
local TS = game:GetService("TweenService")
local part = script.Parent.Cylinder
local RotationRatio = 0.125
local RotValue = RotationRatio * 360
local EndPos = part.CFrame * CFrame.Angles(math.rad(RotValue), 0, 0)
local tweenInfo = TweenInfo.new(
0.85,
Enum.EasingStyle.Sine,
Enum.EasingDirection.In,
0,
false,
0
)
local tween = TS:Create(part, tweenInfo, EndPos) --here
while true do
tween:Play()
wait(5)
end
TweenService:Create() requires the third argument to be a Dictionary in order to process it.
This is to allow you to change more than one property of your object, which is formatted as: {property = value}
For Example, if I wanted to change a Parts color, and its rotation, I would tell TweenService using a Dictionary, as such:
{Color = Color3.new(1,0,0); Orientation = Vector3.zero}
-- I need to define what to change in order for it to do it correctly
-- Color is defined for Coloring
-- Orientation is Defined in order to Rotate it
The third argument of a tween is supposed to be a dictionary value, which would be written like this in your case TS:Create(part, tweenInfo, {CFrame = EndPos})