Hey,
So I am working on a project and having NPC walk to points. There is a point where they all need to stand in one line, but one of them tends to be turned a little. Is there anyway I can rotate a NPC to face a direction? IE. Place a brick in front of them and they would all face that brick?
Thanks,
Anthony
Well we can use cframe to make it point in a certain direction
First let's set our variables
local npc=workspace.npc local lookat=workspace.Part
Here is how you make a cframe that points in a certain direction
local cf = CFrame.new(Vector3Position,Vector3Lookat)
Let's hook it up to your npc
local cf = CFrame.new(npc.HumanoidRootPart.Position,lookat.Position)
Now we can either set the cframe of the model's primary part if its set or we can add a bodygyro and add our variable to it
Bodygyro:
local bg=Instance.new("BodyGyro",npc.HumanoidRootPart) bg.cframe=cf --bodygyro also uses cframe besides CFrame --you may want to change other properties of the instances too
primarypart (if its set in the npcs)
npc:SetPrimaryPartCFrame(cf)
You could use one of these methods after your npc has reached its destination.