Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Trying to code a pathfinding AI to go to the players position, but the dummy wont move? please help

Asked by 4 years ago

Trying to code an ai that pathfinds to the player's position. No errors are in the output, so not sure why this isn't working. Any help is appreciated :)

script.Parent.HumanoidRootPart.Anchored = false
function move(playerPos)
    local human = script.Parent.Humanoid
    local torso = script.Parent.HumanoidRootPart
    local service = game:GetService("PathfindingService")

    local path = service:CreatePath()
    path:ComputeAsync(torso.Position,playerPos)
    local waypoints = path:GetWaypoints()

    for i, v in pairs(waypoints) do
        human:MoveTo(v.Position)
        human.MoveToFinished:Wait(2)
    end
end


game.Players.PlayerAdded:Connect(function(plr)
    plr.CharacterAdded:Wait()

    move(plr.Character:WaitForChild("Humanoid").Parent.HumanoidRootPart.Position)
end)

1 answer

Log in to vote
0
Answered by 4 years ago

humanoidrootpart unanchor u poop

0
t COMBATKOALA 5 — 4y
Ad

Answer this question