Repeat loop not working properly?

For some reason, the repeat loop doesn’t end even if the requirements are met

Any help is appreciated

Code:

repeat
	Lerps[#Lerps + 1] = {}
	
	for i = 1, #Lerps[#Lerps - 1] - 1 do
		table.insert(Lerps[#Lerps], Lerps[#Lerps - 1][i]:Lerp(Lerps[#Lerps - 1][i + 1], Index))
	end

	task.wait(0.1)
until #Lerps[#Lerps] == 1
1 Like

I don’t know how your not getting an error. You are checking if the length of the array (a number) at index length of array is 1, essentially you are looking for a number in a number.

Change that to:
Lerps[#Lerps] == 1

1 Like

it just gives me the table with the Lerps table length index

i printed it and that’s what i got:
image

1 Like

what are you trying to do btw?

1 Like

im trying making a bezier curve system that works with infinite amount of points

1 Like

I meant, what is this piece of code trying to do, bc It’s very confusing for me to read bc of all the brackets and there’s a for loop in a repeat until loop. Also, sorry for late replies lol

Try this:

repeat
	Lerps[#Lerps + 1] = {}
	
	for i = 1, Lerps[#Lerps - 1] - 1 do
		table.insert(Lerps[#Lerps], Lerps[#Lerps - 1][i]:Lerp(Lerps[#Lerps - 1][i + 1], Index))
	end

	task.wait(0.1)
until Lerps[#Lerps] == 1