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

How do I make the block travel in the direction I'm facing?

y.velocity = Vector3.new(0, -10, 12)

The code above makes the block travel but I want it to travel in the direction I'm facing, How would you do that?

1 answer

✓ Accepted answer

In order to move a block the direction you're facing, obviously you must have some way of accessing which direction you're facing. This is done by using lookVector. lookVector is a property of CFrame that allows you to access which way an object is facing.

"The lookVector of a CFrame is a unit vector pointing in the direction of the CFrame's forward direction (-z in object space) or front face." -BlueTaslem

workspace.Part.Velocity = workspace.Part.CFrame.lookVector * 100

This will make an unanchored and unattached Part move toward its front face. We multiply it by 100 just to add some speed.

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