hey, I can’t get this bug fixed and I need help.
The npc won’t move at all, it has a humanoid, fully unanchored, hipheight set, walkspeed and all but he still won’t move,
i added prints to the script if the pathfinding is successful and it is, and it says he’s moving but he’s not.
function Bosses:MoveTo(char)
local success, err = pcall(function()
path:ComputeAsync(self.Model.PrimaryPart.Position, Vector3.new(char.PrimaryPart.Position.X, self.Model.PrimaryPart.Position.Y, char.PrimaryPart.Position.Z))
end)
print(err) -- Doesn't print
if success and path.Status == Enum.PathStatus.Success then
print("Success path") -- prints
self.waypoints = path:GetWaypoints()
for i, v in pairs(self.waypoints) do
local part = Instance.new("Part")
part.Size = Vector3.new(0.5,0.5,0.5)
part.CanCollide = false
part.Anchored = true
part.Position = v.Position
part.Parent = workspace
end
self.blockedConnection = path.Blocked:Connect(function(blockedWaypointIndex)
if blockedWaypointIndex >= self.nextWaypointIndex then
self.blockedConnection:Disconnect()
self:MoveTo(char)
end
end)
if not self.reachedConnection then
print("No connection, making one...") -- prints
self.reachedConnection = self.Model.Humanoid.MoveToFinished:Connect(function(reached)
print(reached) -- prints false after the first move
print(self.nextWaypointIndex) -- 2
if reached and self.nextWaypointIndex < #self.waypoints then
print("adding 1 to next wp") -- doesn't print since reached is false
self.nextWaypointIndex += 1
self.Model.Humanoid:MoveTo(self.waypoints[self.nextWaypointIndex].Position)
print("Moving2")
else
self.reachedConnection:Disconnect()
self.blockedConnection:Disconnect()
print("Path reached")
end
end)
end
self.nextWaypointIndex = 2
self.Model.Humanoid:MoveTo(self.waypoints[self.nextWaypointIndex].Position)
print("Moving") -- prints
else
warn("Path not computed")
end
end
in this video you can see the wp getting created, and the WalkTo property changes in the humanoid and it doesn’t move him, if i went to the server and put a custom position in the explorer it would move him, which is weird