I tried adjusting free model scripts, but it didn’t work, and I searched ‘pathfinding’ on the dev forum, but no luck on finding a solution, if you have questions, please ask. (I want to learn, please don’t give entire scripts) thanks!
Thedevking made a great tutorial:
I think you can set the end part to the player and recompute the path to make it follow the player, but I don’t know, i just learned this recently.
1 Like
How would you pathfind to the nearest player in a certain radius?
I tried this, but it didn’t work, and it is in a serverscript in the character (a model) also, no errors
local Path = game:GetService("PathfindingService")
local human = script.Parent:WaitForChild("Humanoid")
local torso = script.Parent:WaitForChild("LowerTorso")
local path = Path:CreatePath()
path:ComputeAsync(torso.Position, game.Workspace.NoCross.Position)
local waypoints = path:GetWaypoints()
for i, waypoint in pairs(waypoints) do
local part = Instance.new("Part")
part.Shape = "Ball"
part.Material = "Neon"
part.Size = Vector3.new(0.6,0.6,0.6)
part.Anchored = true
part.Parent = workspace
if waypoint.Action == Enum.PathWaypointAction.Jump then
human:ChangeState(Enum.HumanoidStateType.Jumping)
end
human:MoveTo(waypoint.Position)
human.MoveToFinished:Wait(2)
end
human:MoveTo(game.Workspace.NoCross.Position)
It would seem to be a bunch of sounds.