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

zombie moves only once and doesn't turn and continue?

Asked by 3 years ago
Edited 3 years ago

i'm making a game kinda like tower defense simulator where zombies follow a winding path
however, the zombie only moves once and doesn't turn and continue
here's the script:

for i, v in pairs(game.Workspace.Path:GetDescendants()) do
    if v:IsA("Part") then
        script.Parent.Torso.AlignPosition.Attachment1 = v.ZPos
        repeat wait() until script.Parent.HumanoidRootPart.Position == v.Position
        script.Parent.Torso.AlignOrientation.Attachment1 = v.ZRot
    end
end

1 answer

Log in to vote
0
Answered by 3 years ago
Edited 3 years ago

Maybe the position isnt exactly the same. Try checking for if the distance is close but not exact. Try using

Distance = (part1.pos - part2.pos).magnitude 

Hope this helps :3

0
the position isn't the same Quintizzle 6 — 3y
0
Well theres the problem, your checking the position of the part to see if it matches position of path, bu5 if its never the same it wont run thr next part in the loop AlexanderYar 788 — 3y
Ad

Answer this question