Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

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

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

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

2 comments

0

the position isn't the same

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

This discussion is preserved as it was. New answers, comments, and votes are closed.