I tried to create something that targets the nearest player. I don't know how to target the nearest player, but I got the path finding thing down.
Here's what I've got so far:
for i,v in pairs(workspace:GetChildren()) do
if v:FindFirstChild("HumanoidRootPart") then
if v.HumanoidRootPart.Position.Magnitude <= 15 then
local HRP = v.HumanoidRootPart
local OHRP = script.Parent.HumanoidRootPart
local human = script.Parent.Humanoid
local path = game:GetService("PathfindingService"):FindPathAsync(OHRP,HRP)
local points = path:GetWaypoints()
if path.Status == Enum.PathStatus.Success then
for i,v in pairs(points) do
human:MoveTo(v.Position)
human.MoveToFinished:Wait()
if v.Action == Enum.PathWaypointAction.Jump then
human.Jump = true
end
end
end
else
wait()
end
end
end

1 comment
Thanks! WIll try it later!