Getting the error: ServerScriptService.BunnyHandler.MainBunny:28: invalid argument #1 to 'pairs' (table expected, got nil)

			for k, v in pairs (BunnyConfig.Bunnys) do
			    if v.ID == bunnyName then
			       bunnyID = v.ID
			        break
			    end
			end

After this loop.

It gives me NormalBunny. So it is working just the SetProperties function is giving an error which is the same error.

Which line of code in the function?

	for guiObjctName, labelProperties in pairs(propertiesTable) do

Ah, I see. Its the way you set up the module. When you setted up the bunnys module you didn’t set the ID as in like the table. You should do:

Example for 1 bunny:

Module.Bunnys = {

	["NormalBunny"] = {
		Icon = 'rbxassetid://9432469802',


		Display = {
						
			Rarity = Module.Rarities[1],

			Title = {

				Text = 'Normal Bunny',
				TextColor3 = Color3.new(1, 1, 1),
			}
		}
	}
}

this is what you should do for each one. And then from there replace this

for k, v in pairs (BunnyConfig.Bunnys) do
			    if v == bunnyName then
			       bunnyID = v
			        break
			    end
			end

Ok. local nil = nil ← just did this too exceed the least amount of characters required

I don’t get what you mean? Just set the Id as a table, you didn’t set it as one before.

Just ignore it, I am pasting it in and it has a red line under the “NormalBunny” = {

I fixed it, check the code again. Just do that for each bunny. Make the Id as the table and add its stuff inside.

I dont understand sorry please explain

So apparently, the reason why it’s giving an error is that it thinks the “ID” has a table. But it does not as you can see in your old module. That is why it is returning a nil value. With the example I gave you, I set the ID as a table for the other stuff. You hear what I mean?

Also your code is giving the error Expected ‘}’ (to close ‘{’ at line 30), got ‘function’ I am adding them to fit all the bunnys for example, Normal Bunny and Flower Bunny

Yeah, I know. It’s hard to write code in the dev forum, so it may not always be perfect.

Yeah. I understand. I started scripting 2 years ago and took a 3 month break, 5 months ago so I am still refreshing my mind :blush:

I am adding } and }, but it is still not workng

Please show the piece of code.

Replace it with that. I think it messed up at first because when I first posted it was a bit messy.


	["NormalBunny"] = {
		Icon = 'rbxassetid://9432469802',


		Display = {

			Rarity = Module.Rarities[1],

			Title = {

				Text = 'Normal Bunny',
				TextColor3 = Color3.new(1, 1, 1),
			}
		}
	},
	{
		["NormalBunny"] = {
			Icon = 'rbxassetid://9432469802',


			Display = {

				Rarity = Module.Rarities[1],

				Title = {

					Text = 'Normal Bunny',
					TextColor3 = Color3.new(1, 1, 1),
				}
			}
		}
	}

I am going to add more

Remove this out of the code. You don’t need it

It is still saying the same thing, I am sorry to put you through this

This piece here is the fixed one.