How would I get the varible the same as the index without looping?

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

  1. What do you want to achieve? Keep it simple and clear!
    I want to make the varible the same as the index heres an example:
local Table =  { 
[1] = 1
[2] = 2
}
  1. What is the issue? Include screenshots / videos if possible!
    The issue is it keeps on looping. I used i,v in pairs to get the index

  2. What solutions have you tried so far? Did you look for solutions on the Developer Hub?
    I looked in Developer Hub, I tried pairs, ipairs, and next and it still keeps on looping

After that, you should include more details if you have any. Try to make your topic as descriptive as possible, so that it’s easier for people to help you!

Please do not ask people to write entire scripts or design entire systems for you. If you can’t answer the three questions above, you should probably pick a different category.

Why can’t you use something like this. It removes the need for the table:

for i = 1, 10 do
	print(i)
end

Im making something that needs a table.

Could you please be more clear? What does the script look like so far?

local Add = script.Parent.Add
local Properties = script.Parent.PropertiesFrame
local Items = script.Parent.ItemsFrame
local Exit = script.Parent.X

local FrameTable = {}
local ScrollingTable = {}
local TextLabelTable = {}
local TextButtonTable = {"n"}
local TextBoxTable = {}
local ImageButtonTable = {}
local ImageLabelTable = {}
local VideoFrameTable = {}

local TestTable = {}


for i,v in pairs(Add:GetChildren()) do
	if v:IsA("TextButton") then
		v.MouseButton1Click:Connect(function()
			local object = Instance.new(v.Name)
			if object then
				if object:IsA("TextButton") then
					object.Size = UDim2.new(0.146, 0,0.065, 0)

				elseif object:IsA("TextBox") then
					object.Size = UDim2.new(0.146, 0,0.065, 0)
				elseif object:IsA("TextLabel") then
					object.Size = UDim2.new(0.146, 0,0.065, 0)
				elseif object:IsA("ImageButton") then
					object.Size = UDim2.new(0.073, 0,0.13, 0)	
				elseif  object:IsA("ImageLabel") then
					object.Size = UDim2.new(0.073, 0,0.13, 0)	
				elseif  object:IsA("Frame") then
					object.Size = UDim2.new(0.073, 0,0.13, 0)	
				elseif object:IsA("ScrollingFrame") then
					object.Size = UDim2.new(0.073, 0,0.13, 0)	
				elseif object:IsA("VideoFrame") then
					object.Size = UDim2.new(0.073, 0,0.13, 0)	
				end

				object.Parent = Main
				object.Visible = true
				object.Position = UDim2.new(.5,0,.5,0)
				object.BackgroundColor3 = Color3.new(1,0,0)



			end
		end)
	end
end

local SizeFrame = Properties.SizeFrame

local sizexframe = SizeFrame.X
local sizeyframe = SizeFrame.Y

local sizeXoffset = sizexframe.Offset
local sizeXscale = sizexframe.Scale

local sizeYoffset = sizeyframe.Offset
local sizeYscale = sizeyframe.Scale




Main.ChildAdded:Connect(function(object)
	print(object.ClassName)
	
	if object:IsA("TextButton") then
		print("object is a "..object.ClassName)
		for i,v in pairs(TextButtonTable) do
			wait(1)
			print(TextButtonTable)
			if i == nil then
				print("nil")
				table.insert(TextButtonTable,1,"1")
				print(TextButtonTable)
			else
				if TextButtonTable[1] == "n" then
					table.remove(TextButtonTable,1)
					table.insert(TextButtonTable,1,i)
				else
					table.insert(TestTable, i,i)
				end
				print("not nil")
				
				print(TextButtonTable)
			end

		end
	elseif object:IsA("TextBox") then

	elseif object:IsA("TextLabel") then

	elseif object:IsA("ImageButton") then

	elseif  object:IsA("ImageLabel") then

	elseif  object:IsA("Frame") then

	elseif object:IsA("ScrollingFrame") then

	elseif object:IsA("VideoFrame") then

	end


end)

for i,itemss in pairs(Items:GetChildren()) do
	if itemss:IsA("TextButton") then
		itemss.MouseButton1Click:Connect(function()
			Properties.Visible = true
			script.Parent.PropertiesText.Visible = true
			local Item = Instance.new("TextButton")


		end)
	end
end

sizeXoffset.FocusLost:Connect(function(enter)
	if enter then

	end

end)


--[[game:GetService("RunService").Heartbeat:Connect(function()
	if Properties.Visible == false then

	else
		Add.Size = UDim2.new(0.3, 0,0.9, 0)
		Add.Position = UDim2.new(0, 0,0.1, 0)
	end

end) --]]

Im making something like google.

I dont really understand where the table you are making plays into the larger script. Where exactly is it used and what is it used for?

As for creating it, the easiest way is to just use a for-loop

function createArray(from, to)
  local t = {}
  for i = from, to do
    t[i] = i
  end
  return t
end

Technically, you could do something with metatables:

local t = {}
setmetatable(t, {
  __index = function(_, k)
    return k
  end
})

Ima just do another way, I think I dont need a table anymore but thank you for helping me