Humanoid:MoveTo issue

How do i make each individual humanoid move to its target position and not all at the same time, i tried it but it was still the same

does anyone know the solution for this?

local totalrigs = workspace.Rigs
local rigs = workspace.Rigs:GetChildren()
local parts = workspace.Parts:GetChildren()

local function MoveTo(humanoid:Humanoid, target:Part)
	humanoid:MoveTo(target.Position)
end

local function Random(humanoid:Humanoid)
	MoveTo(rigs[math.random(1, #rigs)].Humanoid, parts[math.random(1, #parts)])
end

for _,humanoid:Humanoid in pairs(totalrigs:GetDescendants()) do
	if humanoid:IsA("Humanoid") then
		for i=1, math.random(2,10) do
			Random(humanoid)
		end
	end
end

If you add humanoid.MoveToFinished:Wait() it will wait for each Humanoid to finish their movement.

Just add humanoid.MoveToFinished:Wait() after you call MoveTo and you should be good to go

it would work but i wanna make all rigs start moving, not by one by one or in order

Elaborate, in your problem you stated that you don’t want them all to move to their target at the same time

what i mean by “not all at the same time” is that Humanoid:MoveTo() should not be called for all rigs but each individual

So from what im getting is, you want each NPC to move to a place, and when they are finished they move to a new place, each individual threads. What you have in your other post is already pretty good so i suggest we go to that one. For the future I would also recommend staying in one post and not creating another one for the same issue.

1 Like

@Fietowski fixed the problem in the script in the other post

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.