Tween oddly affecting orientation

I’m trying to implement ModuleScripts into my game to essentially streamline interactable objects, but for some reason whenever I tween with the ModuleScript the orientation, though using LookVector, is oddly set to (0,0,0).

Ex: https://gyazo.com/037faf34ed3e211a03f2ea807647d8b1

Here’s the ServerScript (Don’t mind the -1 multiplied by the look vector, it’s to simply flip it because I didn’t feel like rebuilding my dressers):

local CurrentStatus = Interaction:FindFirstChild("Status")
			
			Drawer.Status = CurrentStatus.Value
			Drawer.Part = Interaction
			Drawer.TweenedPosition = CFrame.new(Interaction:FindFirstChild("OriginalPos").Value  + (-1 *Interaction.CFrame.LookVector * 2))
			Drawer.Position = CFrame.new(Interaction:FindFirstChild("OriginalPos").Value)
			
			if Drawer.Status == false then
				local CF = {
						CFrame = Drawer.TweenedPosition
				}
				CurrentStatus.Value = true
				Drawer:Open(Interaction,CF,CurrentStatus.Value)
			else
				local CF = {
					CFrame = Drawer.Position
				}
				CurrentStatus.Value = false
				Drawer:Close(Interaction,CF,CurrentStatus.Value)
			end

And here’s the modulescript:

function Interactables:Open(interacted,pos,state)
	TweenService:Create(interacted,tweenInfo,pos):Play()
	self.Status = state
end

function Interactables:Close(interacted,pos,state)
	TweenService:Create(interacted,tweenInfo,pos):Play()
	self.Status = state
end

I have absolutely no idea what I’m doing wrong. Any help?

Thanks!

2 Likes

CFrame represents the position and orientation, by not providing an orientation for the created CFrames, it defaults to 0, 0, 0, so the part faces forwards no matter what. Add an orientation argument when creating the CFrame that keeps the part’s current orientation.

2 Likes

CFrame values contain position and orientation data. If you were to just give it positional data, the orientation would be default, 0,0,0.

1 Like

So how would I give it the positional and orientational while using look vector so it faces the correct way? Do I just do Position * Orientation?

You can create a CFrame orientation by using CFrame.Angles(rx,ry,rz) in Radians. If you don’t know what radians are, you can use math.rad(degree).