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

how do I make the humanoid MoveTo a random position based on a X and Z offset?

Asked by
Prioxis 673 Moderation Voter
10 years ago

so for my game I want the zombies to wander to random positions offset from their current locations.. but how exactly would I accomplish this?

I tried making a script but since i'm not very knowledgeable in this area it didn't turn out.

while true do
    wait(math.random(1))
    local target = findNearestTorso(script.Parent.Torso.Position)
    if target ~= nil then
        script.Parent.Zombie:MoveTo(target.Position, target)
    else
        script.Parent.Zombie:MoveTo("uhhh") -- my attempt
    end

end

so yeah my attempt as you can see is like nothing..

Answer this question