Why doesnt my table work?

Hello! I’ve been working on a plugin and I recently got this message

“Out of local registers”

I know there is a max of 200 local vars, I heard you can combat this by making a table, sadly I tried and it doesn’t even work saying to remove local, then it suggests to change it to local again. How can I properly fix this?

Note: The original table has over 200 local vars

 local CoolTable = {
			local Lunarious_UI = Instance.new("ScreenGui")
			local Frame = Instance.new("Frame")
			local ResizeWholeScreenButton = Instance.new("TextButton")
			local UICorner = Instance.new("UICorner")
			local InsertTextButton = Instance.new("TextButton")
			local UICorner_2 = Instance.new("UICorner")
			local InsertTextButton_Button = Instance.new("TextButton")
			local UICorner_3 = Instance.new("UICorner")
			local InsertTextBox = Instance.new("TextButton")
			local UICorner_4 = Instance.new("UICorner")
			local InsertScrollingFrameButton = Instance.new("TextButton")
			local UICorner_5 = Instance.new("UICorner")
			local InsertImage = Instance.new("TextButton")
			local UICorner_6 = Instance.new("UICorner")
			local InsertFrameButton = Instance.new("TextButton")
			local UICorner_7 = Instance.new("UICorner")
			local UICorner_8 = Instance.new("UICorner")
			local BrowseUI = Instance.new("Folder")
			local Section_1 = Instance.new("Folder")
			local Sample1 = Instance.new("Frame")
			local UICorner_9 = Instance.new("UICorner")
			local Sample1_Shadow = Instance.new("Frame")
			local UICorner_10 = Instance.new("UICorner")
			local Sample2 = Instance.new("Frame")
			local UICorner_11 = Instance.new("UICorner")
			local Sample2Curve = Instance.new("Frame")
			local UICorner_12 = Instance.new("UICorner")
			local Sample2_Shadow = Instance.new("Frame")
			local UICorner_13 = Instance.new("UICorner")
			local BackButton = Instance.new("TextButton")
			local UICorner_14 = Instance.new("UICorner")
			local PageUpButton = Instance.new("TextButton")
			local UICorner_15 = Instance.new("UICorner")
			local Selection1Button = Instance.new("TextButton")
			local Selection2Button = Instance.new("TextButton")
			local PremadeTitle1 = Instance.new("TextLabel")
			local PremadeTitle2 = Instance.new("TextLabel")
			local SampleText1 = Instance.new("TextLabel")
			local SampleText2 = Instance.new("TextLabel")
			local SampleTitle1 = Instance.new("TextLabel")
			local SampleTitle2 = Instance.new("TextLabel")
			local Section_2 = Instance.new("Folder")
			local Sample3 = Instance.new("Frame")
			local UICorner_16 = Instance.new("UICorner")
			local Sample3_Shadow = Instance.new("Frame")
			local UICorner_17 = Instance.new("UICorner")
			local Sample4 = Instance.new("Frame")
			local UICorner_18 = Instance.new("UICorner")
			local Sample4_Shadow = Instance.new("Frame")
			local UICorner_19 = Instance.new("UICorner")
			local BackButton2 = Instance.new("TextButton")
			local UICorner_20 = Instance.new("UICorner")
			local PageUpButton2 = Instance.new("TextButton")
			local UICorner_21 = Instance.new("UICorner")
			local Selection3Button = Instance.new("TextButton")
			local Selection4Button = Instance.new("TextButton")
			local PremadeTitle3 = Instance.new("TextLabel")
			local PremadeTitle4 = Instance.new("TextLabel")
			local SampleText3 = Instance.new("TextLabel")
			local SampleText4 = Instance.new("TextLabel")
			local SampleTitle3 = Instance.new("TextLabel")
			local SampleTitle4 = Instance.new("TextLabel")
			local Section_3 = Instance.new("Folder")
			local PremadeTitle5 = Instance.new("TextLabel")
			local SampleTitle6 = Instance.new("TextLabel")
			local Selection6Button = Instance.new("TextButton")
			local PremadeTitle6 = Instance.new("TextLabel")
			local BackButton3 = Instance.new("TextButton")
			local UICorner_22 = Instance.new("UICorner")
			local SampleTitle5 = Instance.new("TextLabel")
			local Selection5Button = Instance.new("TextButton")
			local Sample5 = Instance.new("Frame")
			local UICorner_23 = Instance.new("UICorner")
			local Sample5_Corner = Instance.new("Frame")
			local UICorner_24 = Instance.new("UICorner")
			local Sample6 = Instance.new("Frame")
			local UICorner_25 = Instance.new("UICorner")
			local Sample6_Prompt = Instance.new("Frame")
			local UICorner_26 = Instance.new("UICorner")
			local Sample6_Bar = Instance.new("Frame")
			local UICorner_27 = Instance.new("UICorner")
			local BrowseTitle = Instance.new("TextLabel")
			local Description3 = Instance.new("TextLabel")
			local BrowseUIButton = Instance.new("TextButton")
			local UICorner_28 = Instance.new("UICorner")
			local Description2 = Instance.new("TextLabel")
			local InsertScreenGui = Instance.new("TextButton")
			local UICorner_29 = Instance.new("UICorner")
			local InsertImageButton = Instance.new("TextButton")
			local UICorner_30 = Instance.new("UICorner")
			local Title = Instance.new("TextLabel")
			local Description = Instance.new("TextLabel")
			local Files = Instance.new("Folder")
			local InsertSamples = Instance.new("Folder")
			local Frame_2 = Instance.new("Frame")
			local UICorner_31 = Instance.new("UICorner")
			local ScrollingFrame = Instance.new("ScrollingFrame")
			local UICorner_32 = Instance.new("UICorner")
			local TextLabel = Instance.new("TextLabel")
			local ScreenGui = Instance.new("ScreenGui")
			local TextButton = Instance.new("TextButton")
			local UICorner_33 = Instance.new("UICorner")
			local ImageLabel = Instance.new("ImageLabel")
			local UICorner_34 = Instance.new("UICorner")
			local ImageButton = Instance.new("ImageButton")
			local UICorner_35 = Instance.new("UICorner")
			local TextBox = Instance.new("TextBox")
			local UICorner_36 = Instance.new("UICorner")
			local PremadeUISamples = Instance.new("Folder")
			local Sample1_2 = Instance.new("Folder")
			local Frame_3 = Instance.new("Frame")
			local UICorner_37 = Instance.new("UICorner")
			local FrameShadow = Instance.new("Frame")
			local UICorner_38 = Instance.new("UICorner")
			local SampleText1_2 = Instance.new("TextLabel")
			local SampleTitle1_2 = Instance.new("TextLabel")
			local Sample2_2 = Instance.new("Folder")
			local Sample2_3 = Instance.new("Frame")
			local UICorner_39 = Instance.new("UICorner")
			local Sample2Curve_2 = Instance.new("Frame")
			local UICorner_40 = Instance.new("UICorner")
			local Sample2_Shadow_2 = Instance.new("Frame")
			local UICorner_41 = Instance.new("UICorner")
			local SampleText2_2 = Instance.new("TextLabel")
			local SampleTitle2_2 = Instance.new("TextLabel")
			local Sample3_2 = Instance.new("Folder")
			local Frame_4 = Instance.new("Frame")
			local UICorner_42 = Instance.new("UICorner")
			local FrameShadow_2 = Instance.new("Frame")
			local UICorner_43 = Instance.new("UICorner")
			local Description_2 = Instance.new("TextLabel")
			local Title_2 = Instance.new("TextLabel")
			local Sample4_2 = Instance.new("Folder")
			local FrameCorners = Instance.new("Frame")
			local UICorner_44 = Instance.new("UICorner")
			local Description_3 = Instance.new("TextLabel")
			local Title_3 = Instance.new("TextLabel")
			local Frame_5 = Instance.new("Frame")
			local UICorner_45 = Instance.new("UICorner")
			local Sample5_2 = Instance.new("Folder")
			local Frame_6 = Instance.new("Frame")
			local UICorner_46 = Instance.new("UICorner")
			local FrameCorner = Instance.new("Frame")
			local UICorner_47 = Instance.new("UICorner")
			local SampleTitle5_2 = Instance.new("TextLabel")
			local Sample6_2 = Instance.new("Folder")
			local Sample6_3 = Instance.new("Frame")
			local UICorner_48 = Instance.new("UICorner")
			local Sample6_Bar_2 = Instance.new("Frame")
			local UICorner_49 = Instance.new("UICorner")
			local Sample6_Prompt_2 = Instance.new("Frame")
			local UICorner_50 = Instance.new("UICorner")
			local SampleText1_3 = Instance.new("TextLabel")
			local SampleTitle6_2 = Instance.new("TextLabel")
			local ExitButton = Instance.new("TextButton")
			local UICorner_51 = Instance.new("UICorner")
			local Description3_2 = Instance.new("TextLabel")
			local LPositionButton = Instance.new("TextButton")
			local UICorner_52 = Instance.new("UICorner")
			local CPositionButton = Instance.new("TextButton")
			local UICorner_53 = Instance.new("UICorner")
			local RPositionButton = Instance.new("TextButton")
			local UICorner_54 = Instance.new("UICorner")
			local Frame_7 = Instance.new("Frame")
			local UICorner_55 = Instance.new("UICorner")
			local CoverFrame = Instance.new("Frame")
			local UICorner_56 = Instance.new("UICorner")
			local Title_4 = Instance.new("TextLabel")
			}

Because your still using local In tables. Just remove the locals IN the table, but keep table local.

1 Like
 local CoolTable = {
	Lunarious_UI = Instance.new("ScreenGui")
	Frame = Instance.new("Frame")
	ResizeWholeScreenButton = Instance.new("TextButton")
	UICorner = Instance.new("UICorner")
	InsertTextButton = Instance.new("TextButton")
	UICorner_2 = Instance.new("UICorner")
	InsertTextButton_Button = Instance.new("TextButton")
	UICorner_3 = Instance.new("UICorner")
	InsertTextBox = Instance.new("TextButton")
	UICorner_4 = Instance.new("UICorner")
	InsertScrollingFrameButton = Instance.new("TextButton")
	UICorner_5 = Instance.new("UICorner")
	InsertImage = Instance.new("TextButton")
	UICorner_6 = Instance.new("UICorner")
	InsertFrameButton = Instance.new("TextButton")
	UICorner_7 = Instance.new("UICorner")
	UICorner_8 = Instance.new("UICorner")
	BrowseUI = Instance.new("Folder")
	Section_1 = Instance.new("Folder")
	Sample1 = Instance.new("Frame")
	UICorner_9 = Instance.new("UICorner")
	 Sample1_Shadow = Instance.new("Frame")
	UICorner_10 = Instance.new("UICorner")
	Sample2 = Instance.new("Frame")
	UICorner_11 = Instance.new("UICorner")
	Sample2Curve = Instance.new("Frame")
	UICorner_12 = Instance.new("UICorner")
	Sample2_Shadow = Instance.new("Frame")
	 UICorner_13 = Instance.new("UICorner")
	BackButton = Instance.new("TextButton")
	UICorner_14 = Instance.new("UICorner")
	PageUpButton = Instance.new("TextButton")
	UICorner_15 = Instance.new("UICorner")
	Selection1Button = Instance.new("TextButton")
	Selection2Button = Instance.new("TextButton")
	PremadeTitle1 = Instance.new("TextLabel")
	PremadeTitle2 = Instance.new("TextLabel")
	SampleText1 = Instance.new("TextLabel")
	SampleText2 = Instance.new("TextLabel")
	SampleTitle1 = Instance.new("TextLabel")
}

you can also do it like this

local CoolTable = {}
for i = 1, 10 do
	CoolTable["UICorner_" .. i] = Instance.new("UICorner")
end
for i = 1, 20 do
	CoolTable["Selection" .. i .. "Button "] = Instance.new("TextButton")
end
CoolTable["BackButton"] = Instance.new("TextButton")
2 Likes

The first one doesnt work and errors completely,


Second one seems very unstable if u ask me, would also break my plugin completely

I fixed the issue by adding “;” to the end of each instance

oops yup i forgot to add the , at the ends of each value

also not sure what you mean by unstable but if the first method works for you then grate

1 Like