I know you can use Vector3. But is there anyway to use CFrame? I don't mean that they "Teleport" I mean they walk to that Position.
CFrame is essentially Vector3 with orientation in addition to position. They would be practically the same, since characters will always be upright when walking.
If you want to convert a CFrame to a Vector3, put .p
after the CFrame value. See below code for an example
c = CFrame.new(1,2,3) * CFrame.Angles(4, 5, 6) print(c.p) --> 1,2,3
If you want the npc to move to a certain cframe, you'd have to change the CFrame of the NPC. The easiest way to do this would be to use :SetPrimaryPartCFrame(CFrame)
on the NPC's model, as this will set the CFrame of the primary part (This is by default the head on player characters) and all of the NPC's parts will keep their position relative to the primary part. The following code would make the NPC walk to the CFrame's position then be teleported a short distance to the CFrame.
(Note: npc represents the NPC's model)
c = insertcframehere npc.Humanoid:MoveTo(c.p) npc.Humanoid.MoveToFinished:wait() npc:SetPrimaryPartCFrame(c)
You can also put a BodyPosition in the torso of the NPC, although figuring out the force and speed and all will be tricky.
This is not a request forum, but I'll make the base of your code, you can load the animations yourself.
local Npc = game.Workspace.NPC -- Set a variable for the NPC for i=1,100 do -- Create a loop to move the NPC wait() -- Wait so you can visually see the NPC move Npc.Torso.CFrame= Npc.Torso.CFrame * CFrame.new(0,0,-.1) -- Move The NPC end