Error Tweening Vector3s (Unable to cast to Dictionary)

how do I tween Vector3 Values, I am setting the goal Position of an Align Position Constraint, and instead of instantly setting the new goal each time it changes (I’m making a vehicle), how do I get it to smoothly transition. This is my code:

local function tweenDirection(goalVector)
    print(goalVector)
    local VectorValue = Instance.new("Vector3Value")
    VectorValue.Value = UFO.AlignPosition.Position
    local info = TweenInfo.new(0.5, Enum.EasingStyle.Circular)
    local tween = TweenService:Create(VectorValue, info, {goalVector})
    VectorValue.Changed:Connect(function()
        UFO.AlignPosition.Position = VectorValue.Value
    end)
    tween:Play()
    tween.Completed:Connect(function()
        VectorValue:Destroy()
    end)
end

For some reason it fires this error:
image

whats goalVector

gggggggggggggggggggggggggggggggg

tweenDirection(defaultPos + (cframe.lookVector - cframe.rightVector).unit * speed)

goal vector could be a few things, but always in this format

this should work

local function tweenDirection(goalVector)
    print(goalVector)
    local VectorValue = Instance.new("Vector3Value")
    VectorValue.Value = UFO.AlignPosition.Position
    local info = TweenInfo.new(0.5, Enum.EasingStyle.Circular)
    local tween = TweenService:Create(VectorValue, info, {Value = goalVector})
    VectorValue.Changed:Connect(function()
        UFO.AlignPosition.Position = VectorValue.Value
    end)
    tween:Play()
    tween.Completed:Connect(function()
        VectorValue:Destroy()
    end)
end

It does, what did you change I litterally can’t find a difference in the two lmao
Ah nvm I see it, I forgot the “Value =”

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.