Ad
Still have questions? Join our Discord server and get real time help.
Log in to vote
0

How do I make it so when the zombie has no target close enough it goes to a certain part?

Asked by 1 month ago

I know nothing about stuff f like this, so help would be appreciated :)

I am making a zombie that goes to a certain part when it has no target

Part of the script:

function walkRandomly()
    local xRand = math.random(-50,50)
    local zRand = math.random(-50,50)
    local goal = myRoot.Position + Vector3.new(xRand,0,zRand)

    local path = game:GetService("PathfindingService"):CreatePath() path:ComputeAsync(myRoot.Position, goal)
    local waypoints = path:GetWaypoints()

    if path.Status == Enum.PathStatus.Success then
    for _, waypoint in ipairs(waypoints) do
    if waypoint.Action == Enum.PathWaypointAction.Jump then
    myHuman.Jump = true
    end

0
You don't even have a function where you find a target, you only hand us the walk random, which gives us, (in my opinion) nothing to start from. 14zanderbilt 527 — 1mo
0
I can give you the whole script. I'll make a new question RenDevelopment 15 — 1mo

Answer this question