Scripting Helpers is winding down operations and is now read-only. More info→
Ad
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 3 years 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. Cynical_Innovation 595 — 3y
0
I can give you the whole script. I'll make a new question RenDevelopment 15 — 3y

Answer this question