NPC won't walk towards player

So i have this Boss fight where i need the boss to walk towards the player to do melee attacks

The Boss seems to be in a constant ragdoll state/ stands in place instead of walking towards the player

Im all out of ideasa as pathfinding isnt something i really understand.

this is the function that should make the king take a straight path towards the player and it does print the right things when i move towards it.

local function GoToPlayer()
	local Player = Players:GetPlayers()[math.random(1, #Players:GetPlayers())]
	local Character = Player.Character or Player.CharacterAdded:Wait()
	local HRP = Character.PrimaryPart
	
	while wait() do 
		if (King.PrimaryPart.Position - HRP.Position).Magnitude < 10 then
			print(1)
		else
			King.Humanoid:MoveTo(HRP.Position, HRP)
			print(2)
		end
	end
end
1 Like