I am trying to just change position of NPC. I have tried theese i will give you script below. It just change position like adding +5000 X or it turns in their position or it gives error like Vector3 expected got Cframe.
I don’t understand why i cant just move a npc with while loop.
Script:
local npc = script.Parent.Parent:WaitForChild("NPC").HumanoidRootPart.Position
local npcRoot = script.Parent.Parent:WaitForChild("NPC").HumanoidRootPart
--Tried1
while task.wait(0.2) do
npcRoot.CFrame += CFrame.new(npc.X + 1, npc.Y, npc.Z)
npcRoot:PivotTo(CFrame.new(npcRoot:GetPivot().Position) * CFrame.Angles(0, math.rad(-90), 0))
end
--Tried2
while task.wait(0.2) do
npcRoot.Position += Vector3.new(npc.X + 1, npc.Y, npc.Z)
npcRoot:PivotTo(CFrame.new(npcRoot:GetPivot().Position) * CFrame.Angles(0, math.rad(-90), 0))
end
--Tried3
while task.wait(0.2) do
npcRoot.CFrame += Vector3.new(npc.X + 1, npc.Y, npc.Z)
npcRoot:PivotTo(CFrame.new(npcRoot:GetPivot().Position) * CFrame.Angles(0, math.rad(-90), 0))
end