CFrame not updating to expected value

Hi,

I’m trying to update the CFrame position of something, specifically the Z axis, however what’s really being updated is the X axis instead and I’m clueless as to why.

CFrame before:

CFrame after:

Code

    local posTween = TweenService:Create(bookModel.PrimaryPart, TweenInfo.new(0.5), { CFrame = bookModel.PrimaryPart.CFrame * CFrame.new(0, 0, 4) })
    posTween:Play()

As seen in the code above, I’m trying to increase the Z axis value by 4, however it’s the X axis value that gets changed instead.
Any help would be great thanks!

maybe it has to do with CFrame having rotational values, specifically LookVector; my assumption is that the lookVector might be in the x axis thus setting the x instead of the z axis; try using a normal Vector3 instead

3 Likes

This was causing it, thank you! :slight_smile:

2 Likes

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