How to combine CFrame.new() and CFrame.lookalong()

So I have this basic interpolation script however I’m not sure how to combine the two :PivotTo Methods as it just looks werid. I have tried everything to get it to work but it doesn’t work.

   self.MoveConnection = RUN_SERVICE.RenderStepped:Connect(function(delta)
        Alpha = math.clamp(Alpha + (self.WalkSpeed * delta) / (StartPosition - location).Magnitude, 0, 1) 
        
        local Interpolation: Vector3 = StartPosition:Lerp(location, Alpha)

        -- I want to combine these two PivotTo methods into one line but how? 
        self.Model:PivotTo(CFrame.new(Interpolation)) 
        self.Model:PivotTo(CFrame.lookAlong(Interpolation, (location - StartPosition).Unit))
        
        if Alpha >= 1 then
            self.MoveConnection:Disconnect()
        end
    end)

Im pretty sure there would be no difference if you removed the first PivotTo

1 Like

It appears that self.Model:PivotTo(CFrame.new(Interpolation)) will not do anything as you are overriding it in the next line, you should only need the self.Model:PivotTo(CFrame.lookAlong(Interpolation, (location - StartPosition).Unit)) line.

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