why is the npc teleporting instead of walking slowly it instantly move to the player , this is my script inside of the npc model:
the script is not full but i have the character limit, this is the part where its not working i think
while true do
local target = GetClosestPlayer()
if target then
repeat task.wait() until target.Character or target.CharacterAdded:Wait()
path = CreatePlayerPath(target)
if path then
waypoints = path:GetWaypoints()
for _, waypoint in pairs(waypoints) do
local part = Instance.new("Part")
part.Position = waypoint.Position
part.Size = Vector3.new(.5,.5,.5)
part.Color = Color3.new(1,0,1)
part.Anchored = true
part.CanCollide = false
part.Parent = workspace
game.Debris:AddItem(part,.5)
npc:MoveTo(waypoint.Position)
end
end
else
npc:MoveTo(npcHRP.Position)
path = nil
waypoints = nil
end
runservice.Heartbeat:Wait()
end