I read somewhere that when they tried to enslave Natuve Americans it was unsuccessful, but what made the colonists decide to import Africans rather than another peoples?
To clarify, Native Americans were enslaved, in tremendous numbers, from the beginning of contact to the 20th century, from the high Arctic to the Southern Cone. Indigenous slavery was pervasive across the Americas, and only when their population decreased in a specific region through the combination of warfare, disease, territorial encroachment, slaving raids, and resources deprivation did European colonists look to Africa as the main source of their unpaid labor. I'll quote a previous answer on indigenous slavery in the Spanish Empire below, and let my colleagues talk about the growth and justification for the transition to African slavery.
Slavery is a slippery concept and enslavement of indigenous Americans existed throughout the Spanish Empire wherever and whenever political will failed to enforce the law. There are various degrees of unpaid labor. At worst, outright slaving raids tended to exist on the fringes of the Empire where officials either turned a blind eye, or were unable to stop the process. These forms of enslavement could range from abducting unsuspecting young men, who were then trained as interpreters to serve in a future entrada, to mounted slaving raids with the intent to capture and sell many slaves for profit. Translators abducted from the coast of Virginia accompanied the failed attempt to establish a mission near the James River in 1570, and mounted slavers were the first Spaniards to meet Cabeza de Vaca when he stumbled back to the northern border of Mexico in 1537. We see ongoing reference to these outlaw slaving raids throughout the northern borderlands in California, Arizona, New Mexico and Texas for centuries.
Within the heart of the Empire other forms of unpaid labor dominated, holding indigenous Americans in de facto slavery by means of unpaid or forced labor. For example, in the famous silver mines of Potosi, Bolivia the Spanish corrupted an pre-existing Andean model of shared labor called the mit'a system to conscript 13,000 men a year for the silver mines. Travel to, and living expenses at Potosi, were often more than miners would make underground, leaving them in debt to the mines and working past their conscription duty to pay off their debts. Other forms of wage slavery kept Native Americans tied to land or debtors, where they existed as slaves in all but name. Life in the missions of the northern borderlands, for example, involved harsh labor practices in an oppressive system where mobility was strictly limited. Neophytes were not considered slaves, but neither were they completely free.
Spain, while the first to practice large-scale enslavement of indigenous Americans, was not the last. Prior to the rise of the African slave trade English slavers operating out of Carolina destabilized the Southeast, with very conservative numbers suggesting 30,000-50,000 Amerindians were captured directly by the British, or by allied Native Americans for sale to the British, and enslaved before 1715. Slavery was a tool to destabilize Spanish-allied nations in Florida. In 1708 the Governor of Florida, Francisco de Corcoles y Martinez estimated ten to twelve thousand Indians were taken by slavers from Florida. Father Joseph Bullones reported that four-fifths of the Christian Indians remaining in Florida after 1704 were killed or enslaved. The scale of raiding was so catastrophic that refugees fled south, hoping for transport and safe haven in Cuba. A ship captain carried 270 Florida refugees to Cuba in 1711, and said he left 2,000 Christian Indians and 6,000 more seeking baptism when he departed the Florida Keys. Gallay's very conservative estimate for the total number of people enslaved, not counting those who died in the associated warfare and displacement, in Florida alone is 15,000-20,000. The peninsula was practically depopulated of Indians by the early eighteenth century.
Unfortunately, Native American enslavement was a consistent and violent part of colonization, from the earliest days of contact, to the later Indian Wars in the Southwest. Sources indicate a hidden history of Indian slavery throughout California both before and after statehood, and U.S. soldiers mention slavers abducting those who fell behind during the Navajo's forced Long Walk to Bosque Redondo in 1864. The absolute best overview of Native American slavery is Andrés Reséndez The Other Slavery: The Uncovered Story of Indian Enslavement in America if you would like to learn more. I cannot speak highly enough of this book.