TheBigC10
(Tbc)
November 14, 2020, 10:02pm
#1
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!
minimic2002
(minimic2002)
November 14, 2020, 10:05pm
#2
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:
Hello people!
I’ve been trying for 10 minutes to use the “lookVector” property of a CFrame, but it won’t work.
Tried everything. Basically, I want my part to go 5 studs forward. That’s it.
How to use lookVector?
Thanks in advance,
-Meaxis
1 Like
TheBigC10
(Tbc)
November 14, 2020, 10:12pm
#3
Could you give me an example of this?
minimic2002
(minimic2002)
November 14, 2020, 10:20pm
#4
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.
TheBigC10
(Tbc)
November 14, 2020, 10:29pm
#5
Thanks for this! This really helped me!