I can't make rigs walk towards a part

I would like to make a rig walk towards a set of parts.

The issue is that they won’t move no matter what.

I’ve tried it using Humanoid:MoveTo(), Humanoid.WalkToPoint = vector3position and Humanoid.WalkToPart but none work. I’ve been looking tirelessly for solutions but I haven’t found any. Every part in the rigs are unanchored and I’ve tried everything I could think of.

Here is the full script currently:

task.wait()
local GangNeighbourhood = game:GetService("Workspace"):FindFirstChild("Map 1")
local SuburbanNeighbourhood = game:GetService("Workspace"):FindFirstChild("Map 2")
local Playground = game:GetService("Workspace"):FindFirstChild("Map 3")
local Beach = game:GetService("Workspace"):FindFirstChild("Map 4")
local Desert = game:GetService("Workspace"):FindFirstChild("Map 5")

local GNRigs = GangNeighbourhood:FindFirstChild("Map 1 Rigs"):GetChildren()
local SNRigs = SuburbanNeighbourhood:FindFirstChild("Suburban Rigs")
--local PGRigs = Playground:FindFirstChild("Rigs")
--local BHRigs = Beach:FindFirstChild("Rigs")
--local DTRigs = Desert:FindFirstChild("Rigs")

local CustomerSpawnInterval = 3

local SNCustomerWalksToPoints = SuburbanNeighbourhood:FindFirstChild("CustomerWalksTo")


local function SpawnCustomer(AvailableTrucks)
	if #AvailableTrucks >= 1 then
		local Customer = SNRigs:FindFirstChild("Rig"..tostring(math.random(1, #SNRigs:GetChildren())))
		local CustomerClone = Customer:Clone()
		CustomerClone.Parent = Customer.Parent
		local RandomNumber = math.random(1, #AvailableTrucks)
		local TargetTruck = AvailableTrucks[RandomNumber]
			CustomerClone:FindFirstChild("TargetTruck").Value = TargetTruck
			CustomerClone:MoveTo(SNCustomerWalksToPoints.Spawn.Position)
			if CustomerClone:FindFirstChild("TargetTruck").Value == "Location_1" then
				CustomerClone:FindFirstChild("Humanoid"):MoveTo(SNCustomerWalksToPoints:FindFirstChild("Stop3").Position)
			CustomerClone:FindFirstChild("Humanoid").MoveToFinished:Wait()
				CustomerClone:FindFirstChild("Humanoid"):MoveTo(SNCustomerWalksToPoints:FindFirstChild("Truck1").Position)
			CustomerClone:FindFirstChild("Humanoid").MoveToFinished:Wait()
			elseif CustomerClone:FindFirstChild("TargetTruck").Value == "Location_2" then
				CustomerClone:FindFirstChild("Humanoid"):MoveTo(SNCustomerWalksToPoints:FindFirstChild("Stop4").Position)
			CustomerClone:FindFirstChild("Humanoid").MoveToFinished:Wait()
				CustomerClone:FindFirstChild("Humanoid"):MoveTo(SNCustomerWalksToPoints:FindFirstChild("Stop7").Position)
			CustomerClone:FindFirstChild("Humanoid").MoveToFinished:Wait()
				CustomerClone:FindFirstChild("Humanoid"):MoveTo(SNCustomerWalksToPoints:FindFirstChild("Truck2").Position)
			CustomerClone:FindFirstChild("Humanoid").MoveToFinished:Wait()
			elseif CustomerClone:FindFirstChild("TargetTruck").Value == "Location_3" then
				CustomerClone:FindFirstChild("Humanoid"):MoveTo(SNCustomerWalksToPoints:FindFirstChild("Stop4").Position)
			CustomerClone:FindFirstChild("Humanoid").MoveToFinished:Wait()
				CustomerClone:FindFirstChild("Humanoid"):MoveTo(SNCustomerWalksToPoints:FindFirstChild("Stop8").Position)
			CustomerClone:FindFirstChild("Humanoid").MoveToFinished:Wait()
				CustomerClone:FindFirstChild("Humanoid"):MoveTo(SNCustomerWalksToPoints:FindFirstChild("Truck3").Position)
			elseif CustomerClone:FindFirstChild("TargetTruck").Value == "Location_4" then
				CustomerClone:FindFirstChild("Humanoid"):MoveTo(SNCustomerWalksToPoints:FindFirstChild("Stop2").Position)
			CustomerClone:FindFirstChild("Humanoid").MoveToFinished:Wait()
				CustomerClone:FindFirstChild("Humanoid"):MoveTo(SNCustomerWalksToPoints:FindFirstChild("Stop6").Position)
			CustomerClone:FindFirstChild("Humanoid").MoveToFinished:Wait()
				CustomerClone:FindFirstChild("Humanoid"):MoveTo(SNCustomerWalksToPoints:FindFirstChild("Truck4").Position)
			CustomerClone:FindFirstChild("Humanoid").MoveToFinished:Wait()
			elseif CustomerClone:FindFirstChild("TargetTruck").Value == "Location_5" then
				CustomerClone:FindFirstChild("Humanoid"):MoveTo(SNCustomerWalksToPoints:FindFirstChild("Stop1").Position)
			CustomerClone:FindFirstChild("Humanoid").MoveToFinished:Wait()
				CustomerClone:FindFirstChild("Humanoid"):MoveTo(SNCustomerWalksToPoints:FindFirstChild("Truck5").Position)
			CustomerClone:FindFirstChild("Humanoid").MoveToFinished:Wait()
			elseif CustomerClone:FindFirstChild("TargetTruck").Value == "Location_6" then
				CustomerClone:FindFirstChild("Humanoid"):MoveTo(SNCustomerWalksToPoints:FindFirstChild("Stop2").Position)
			CustomerClone:FindFirstChild("Humanoid").MoveToFinished:Wait()
				CustomerClone:FindFirstChild("Humanoid"):MoveTo(SNCustomerWalksToPoints:FindFirstChild("Stop5").Position)
			CustomerClone:FindFirstChild("Humanoid").MoveToFinished:Wait()
				CustomerClone:FindFirstChild("Humanoid"):MoveTo(SNCustomerWalksToPoints:FindFirstChild("Truck6").Position)
			end
	end
end

while true do
	task.wait(CustomerSpawnInterval)
	--local RandomNumber = math.random(1, 100)
	--if Number >= 1 and Number <= 22 then
	local AvailableTrucks = {}
	for i,v in pairs(SuburbanNeighbourhood:FindFirstChild("Truck_Locations"):GetChildren()) do
		if v:FindFirstChild("Truck") then
			table.insert(AvailableTrucks, v.Name)
			continue
		else
			continue
		end
	end
	
	SpawnCustomer(AvailableTrucks)
	--end
end

Thank you for your time, please help me!

1 Like

Oh and if it helps: Here are the things inside of the dummies. (The WalkSpeed is set to a value higher than 10, so it’s not the issue.)

MoveTo is probably your best option here, but it won’t work if there is something blocking the npc’s path to the part. Since you are also waiting for it to finish moving, the script is yielded forever which renders it disabled. Try making clear paths to each part or even using pathfinding service to move the rig

1 Like

The paths are clear, every part they walk onto is anchored and has cancollide off. There is nothing blocking them and they should be walking just fine normally. There is one thing though that might help. While a session was running, I tried moving everyone of the rigs but none fell back down. I think that has something to do with the issue, but none of the parts in the rigs are anchored, so i’m still unsure. Thank you!

Nevermind, I just checked and the problem was that their accessories we’re anchored. Thank you for your time!

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