The error is unable to cast dictionary and its talking about the "local movingObstacle" line.
local part = game.Workspace.Union local TweenService = game:GetService("TweenService")
local Info = TweenInfo.new(
1,
Enum.EasingStyle.Sine,
Enum.EasingDirection.Out,
-1,
false,
.1
)
local goals = {
part.Position == Vector3.new(8.3, -0.1, 70.3)
}
local movingObstacle = TweenService:Create(part, TweenInfo, goals)
movingObstacle:Play()
Howdy!
You see, your table isn't a dictionary, because part.Position == Vector3.new(8.3, -0.1, 70.3)
is a comparison between a Vector3
and a Vector3
, therefore, it can only be true
or false
.
local goals = { part.Position == Vector3.new(8.3, -0.1, 70.3) --if part has this position then it becomes true, otherwise false }
To fix this, replace the comparing statement ==
with the defining statement =
local goals = { part.Position = Vector3.new(8.3, -0.1, 70.3) }
However, if you run this code, it won't work either, because you are defining the part's Position
as a entry, and the tween can't recognize it. To fix it, you need to define it as just Position
.
local goals = { Position = Vector3.new(8.3, -0.1, 70.3) }
I hope this explained what went wrong with your code.
If you have any questions, feel free to ask them below!