How to position a part towards one direction no matter where it's facing

I’m tweening something and I want to know if there’s a way to move a part backwards no matter what direction it’s facing.

This very detailed thing I made should explain it better lol

2 Likes

Move backwards relative to what?
The original rotation? The world? Etc

Backwards relative to the part.

Would the rotation of the part be changing mid-tween or would it stay constant until the next tween can start?

The Part’s CFrame contains LookVector which is the forward direction. If you want to always move it backward, use the negative LookVector.

1 Like

The tween just moves it in one direction… which is backwards…

Tried this and this is what happened. It still moves backwards relative to the world and not the part

local function keypress(key)
	local down = {CFrame = key.CFrame + key.CFrame.	ZVector * stuff.keyoffset}
	remote:FireAllClients(key, stuff.tweeninfo2, down)
end

I know theres supposed to be a minus sign there and not a plus but that still wouldn’t fix the problem.

What is key.CFrame.ZVector?
Is it a custom made value?

When you compose two CFrames you should use the multiplication symbol. It will make it relative to the original matrix.

Part.CFrame * CFrame.new(0,0,1) -- Local-space Backwards

Vs

Part.CFrame + Vector3.new(0,0,-1) -- World-space backwards

Important to note negative 1 on the Z axis in CFrame multiplication is “forward.” So positive 1 is backwards.

4 Likes

My bad
local function keypress(key)
local down = {CFrame = key.CFrame + key.CFrame. LookVector * stuff.keyoffset}
remote:FireAllClients(key, stuff.tweeninfo2, down)
end

Its possible the servers version of the object isnt rotated the same as the clients, I would just determine the offset on the client
Also @MrNicNac’s solution should work if this doesnt fix the problem
If this is the problem, his solution might not work until you do it on the client