Humanoid:MoveTo() not working unless the player is near the Humanoid?

I’m currently making an automated waiter system for a Bakery. However, my NPC which uses :MoveTo() to walk to different tables is not moving unless my character is in a certain range of the NPC. Any help is appreciated.

robloxapp-20210925-0001441.wmv (3.3 MB)

Current Movement System Code:

local StaffController = {}

local Tables = game.Workspace.Tables
local Staff = game.Workspace.Staff
local StaffPoint = game.Workspace.StaffPoint

local function FindStaff()
	local StaffList = {

	}

	table.clear(StaffList)

	for i,v in pairs (Staff:GetChildren()) do
		if v.Occupied.Value == false then
			v.Occupied.Value = true
			table.insert(StaffList, v)
			print("Staff Not Busy")
		else
			wait()
		end
	end


	local randomStaff = StaffList[math.random(1, #StaffList)]
	
	
	return randomStaff


end

local function MoveWaiter(Table)
	
	if Table.Staff.Value == false then
	
	local FreeStaff = FindStaff()
	Table.Staff.Value = true

	local Humanoid = FreeStaff:FindFirstChild("Humanoid")

	local idleAnimation = Instance.new("Animation")
	idleAnimation.AnimationId = "http://www.roblox.com/asset/?id=507766666"
	local idleAnimationTrack = Humanoid:LoadAnimation(idleAnimation);


	local walkAnimation = Instance.new("Animation")
	walkAnimation.AnimationId = "http://www.roblox.com/asset/?id=507777826"
	local walkAnimationTrack = Humanoid:LoadAnimation(walkAnimation);
	
	print(Table.Position)
		print(FreeStaff)
		
	Humanoid:MoveTo(Table.Position)
	walkAnimationTrack:Play()
	
	Humanoid.MoveToFinished:Wait()
	idleAnimationTrack:Play()
	walkAnimationTrack:Stop()
	
	wait(3)
	
	Humanoid:MoveTo(StaffPoint.Position)
	idleAnimationTrack:Stop()
	walkAnimationTrack:Play()
	
	Humanoid.MoveToFinished:Wait()
	idleAnimationTrack:Play()
	walkAnimationTrack:Stop()
	
	FreeStaff.Occupied.Value = false
	else
		
	end
	
end

function StaffController.ServeTable(Table) 
	
	MoveWaiter(Table)
end



return StaffController

Try setting the network ownership of the NPC to the server.

2 Likes