Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Is there anyway to move a Model relative the Model rotation?

Asked by
Bertox 159
7 years ago
Edited 7 years ago

Is there anyway to move a Model relative the Model rotation? I tried TranslateBy and MoveTo but it needs Vector3

1 answer

Log in to vote
1
Answered by 7 years ago

Use the model's cframe! Cframes have a special value called LookVector which can be used to move the model "forward"!

local Part = script.Parent
local PPart = script.Parent.Part
Part.PrimaryPart = PPart -- Replace PPart with whatever part you want the primary part of your model to be! This is required!
while wait() do
    Part:SetPrimaryPartCFrame(Part:GetPrimaryPartCFrame() + Part:GetPrimaryPartCFrame().lookVector * 3) -- The * 3 is to set the amount of units the model moves
end

This will make the script's parent move in the direction it is facing :)

Ad

Answer this question