So i was trying to post a Question but it only will say " Your title should be specific! Describe your problem concisely" Any was here is the script the for loop at line 12 never runs.

local PathfindingService = game:GetService("PathfindingService")
local char = script.Parent
local Humanoid = char.Humanoid
while true do
	local path = PathfindingService:CreatePath()
    path:ComputeAsync(char.HumanoidRootPart.Position, Vector3.new(char.PrimaryPart.Position.X + math.random(-20,20),char.PrimaryPart.Position.Y + math.random(-20,20),char.PrimaryPart.Position.X + math.random(-20,20)))
	path.Blocked:Connect(function()
		path:ComputeAsync(char.HumanoidRootPart.Position, Vector3.new(char.PrimaryPart.Position.X + math.random(-20,20),char.PrimaryPart.Position.Y + math.random(-20,20),char.PrimaryPart.Position.X + math.random(-20,20)))
	end)
	local waypoints = path:GetWaypoints()
	print("Up to For loop")
	for I, waypoint in pairs(waypoints) do
		print("For loop") -- never gets printed in consale 
		char.HumanoidRootPart:MoveTo(waypoint.Position)
		wait(0.1)
	end
	wait(1)
end

5 comments

0

I tried the loop in a local script, works perfectly fine for me(I replaced "char.HumanoidRootPart:MoveTo" with "Humanoid:MoveTo")

0

it needs to run on sever side and its not a R15 or R6 avatar

1

Your title should be specific describing your problem concisely.

0

I'm not sure if this will help it, but I think the I at line 12 needs to be lowercase.

0

I needs to be lowercased.