Instance and number error?

You can write your topic however you want, but you need to answer these questions:

  1. What do you want to achieve? Make players move with a moving part.

  2. What is the issue? image

  3. What solutions have you tried so far? Youtube.

for count=1,#charactersTouching do
		if charactersTouching[count][1] == character then
			for i=1,#charactersTouching[count]-1 do


				if charactersTouching[count] [i+1] == object then -- error line
				

	if i == 1 then
						table.remove(charactersTouching, count)
					else
						table.remove(charactersTouching[count], i+1)
					end
				end
			end
		end
	end
end

Someone please help. (30char)!

if charactersTouching[count] [i+1] == object then – error line

Do you think you got it? (30char)

What the error says is that i is and object and you are trying to add 1 to it.

i in the script is i = 1 (30char)