Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

Moving a part on ITS AXIS?

So....

I tried to make a part move on it's axis, not the worlds axis using a script and....

ERROR

Yes, I used CFrame... but I'm really bad at using lookVector, I know you do something with it... but what?

DO NOT POST A WIKI LINK TO CFRAME OR LOOKVECTOR WHICH DOESN'T GO ANYWHERE

2 answers

✓ Accepted answer

No need to use lookVector.

local function translate(part, x, y, z)
	-- Multiplying two CFrames returns their composition.
	-- Their rotations and THEN their positions are added.
	
	part.CFrame = part.CFrame	-- CFrame with part's rotation and position
		* CFrame.new(x, y, z)	-- CFrame with no rotation (offset)
end


translate(script.Parent, 2, 0, 0)
local function translate(part, x, y, z)  
part.CFrame = part.CFrame   * CFrame.new(x, y, z)
end


translate(workspace.Particual2, workspace.Particual.Position.X, workspace.Particual.Position.Y, workspace.Particual.Position.Z)

And here's the list!

-> workspace -> Particual1 -> Particual2

This discussion is preserved as it was. New answers, comments, and votes are closed.