How I get only the number in the Script module

How could I do to only get the value that is inside the braces

return {
	ItemsGenerator = {
		Example1 = {
			Color = {Color3.fromRGB(175, 175, 175)},
			SpawnTime = {
				Level1 = {2.5},
				Level2 = {2},
				Level3 = {1},
				Level4 = {0.5}
			}
		}
	}
}

If I do a print it prints me

{
[1] = 30
 }

Why put number in table?
Level1 = 2.5

Anyway to answer your original question

thelevelvariable[1]

1 Like

aa thank you very much, I put 2.5 because those numbers you see are to assign a respawn time

He means, why are you putting the number into a table and then assigning that table to some key when you can assign the number itself.

local table1 = {["Number"] = {3.14}}
local table2 = {["Number"] = 3.14}

print(table1["Number"][1]) --3.14
print(table2["Number"]) --3.14

As you can see it’s easier and more efficient to index the second table than it is the first.

1 Like

I reread your message and I finally understand it, because I did not know it is my first time using module script