Hey Guys! I’m trying to attempt the TweenService to my game but its keep saying “Unable to cast to Dictionary”
Can somebody help me please?
Here is the Script:
local tween = game:GetService(“TweenService”)
local part = Instance.new(“Part”, game.Workspace)
local Size = part.Size + Vector3.new(5,5,5)
part.BrickColor = BrickColor.new(“Really red”)
local goal = (Size)
local info = TweenInfo.new(6, Enum.EasingStyle.Cubic, Enum.EasingDirection.Out, 4, false, 6)
I just made a lengthy reply about how to use TweenServce if you would like to read over it as it may solve your issue:
The reason why you are getting this error is because in TweenService:Create() the third parameter has to be a dictionary and in your code you aren’t defining it as a dictionary. To fix this you should change that part of your code to this:
local play = tween:Create(part, info, {Size = goal})
Full script(I have just tidied the script up a little bit and added the fixed that I explained above):
local tween = game:GetService("TweenService")
local part = Instance.new("Part", game.Workspace)
local Size = part.Size + Vector3.new(5, 5, 5)
part.BrickColor = BrickColor.new("Really red")
local goal = Size
local info = TweenInfo.new(
6,
Enum.EasingStyle.Cubic,
Enum.EasingDirection.Out,
4,
false,
6
)
local play = tween:Create(part, info, {Size = goal})
play:Play()