if target then
local raycastParams = RaycastParams.new()
raycastParams.FilterDescendantsInstances = {target}
local targetPosition = target.HumanoidRootPart.Position + target.HumanoidRootPart.CFrame.LookVector * 13
local raycast = workspace:Raycast(targetPosition, Vector3.new(0, -1000, 0), raycastParams)
if raycast then
script.Parent.HumanoidRootPart.Position = targetPosition
end
script.Parent.Humanoid:MoveTo(target.HumanoidRootPart.Position)
end
wait(1)
if target then
local nearestPoint = FindClosestPoint(target)
if nearestPoint then
script.Parent.HumanoidRootPart.CFrame = nearestPoint.CFrame
end
end
wait(1)
Try adding print()s to each of the places where you directly move the NPC with HumanoidRootPart.CFrame (also, there’s one with .Position instead of .CFrame, change that to .CFrame) to see which one is moving it.
What does FindClosestPoint do? Does it look at the visible squares to find the one nearest to the player? Maybe some squares are invisible?
Are you using a translator or something? Literally nothing in that sentence makes any sense, this whole post exists because the positions are wrong somehow.
I said that everything is determined correctly, except that the humanoid is buggy trying to activate MoveTo(). The problem, in my opinion, is it. robloxapp-20231204-1852399.wmv (3,9 МБ)