Ok, please help me with this script, i want a NPC to move to you, (trying to kill you and do dmg) i got this script so far:
local ps = game:GetService("PathfindingService") math.randomseed(tick()) for _,npc in pairs(workspace.NPCS:GetChildren()) do spawn(function() while true do local humanoid = npc.Humanoid local torso = npc.HumanoidRootPart local pos = torso.CFrame.Position + Vector3.new(math.random(-50,50),0,math.random(-50,50)) local path = ps:CreatePath({AgentHeight = 1, AgentRadius = 1 }) local comp = path:ComputeAsync(torso.CFrame.Position, pos) if path.Status == Enum.PathStatus.Success then local waypoints = path:GetWaypoints() humanoid.Seated:Connect(function(seated) if seated == true then print("seated") humanoid:ChangeState(Enum.HumanoidStateType.Jumping) end end) path.Blocked:Connect(function() print("blocked!") humanoid:MoveTo(torso.CFrame.Position) end) for _,point in pairs(waypoints) do humanoid:MoveTo(point.Position) local part = Instance.new("Part") part.CanCollide = false part.Locked = true part.Anchored = true part.Material = Enum.Material.Neon part.BrickColor = BrickColor.red() part.Size = Vector3.new(1,0.5,1) part.CFrame = CFrame.new(point.Position) part.Transparency = 0 part.Parent = workspace if point.Action == Enum.PathWaypointAction.Jump then print("jumping") humanoid:ChangeState(Enum.HumanoidStateType.Jumping) end humanoid.MoveToFinished.Wait() part:Destroy() end end wait(math.random(2,3.5)) end end) end