Need help with making a beam fire

Hello,
This is what I need help with,
I need the position of this part to only move depending which way its facing. So for example if the part is facing east, it moves west. Same for north and south.
This is what im using. (Isn’t working)

script.Parent.Size = script.Parent.Size + Vector3.new(1,0,0)
script.Parent.CFrame = script.Parent.CFrame + Vector3.new(0,0,0.5)

Thanks!

You will want to use look vector.
Look vector is the direction in which the part is facing

part.CFrame = part.CFrame + part.CFrame.LookVector * 0.1

Some Sources:

1 Like

Could you give me an example of this?

E.g to make a object fly in a line I would do something like

local P = game.Workspace.MovingObject

while true do
    P.CFrame = P.CFrame +  Part.CFrame.LookVector * 0.1
    wait(0.05)
end

This would move it in the direction it is facing at a rate of 20 studs per second.

Thanks for this! This really helped me!