How to test for if "i" has a certain name

Hello i want to make a spin system. I Already made the rarities for the spin system now i just want to check if i is equal to a certain name, it activates something else. Ive tried testing the name for i using

if i.Name = “Common” then

it doesnt seem to work. It doesnt fire any errors in the Output bar, so im wondering if i can test for i’s value/name by using this method. Im fairly new to tables so this might of been a really simple solution.


local Items = {Common = 1000, Uncommon = 150, Rare = 25, PlusUltra = 1}
local System = {}
local totalamount = 0

for i, v in pairs(Items) do
System[i] = {}
System[i][“Min”] = totalamount + 1
System[i][“Max”] = totalamount + v
totalamount = totalamount + v

while true do
local ChosenItem = math.random(1,totalamount)
for i, v in pairs(System) do
if ChosenItem >= System[i][“Min”] and ChosenItem <= System[i][“Max”] then
print(“You have gotten a(n) " …i…” Quirk")

		if i.Name == "Common" then


I think you meant if i == "Common". i is the actual key in the table, and strings don’t have a Name field.

1 Like

Wow that was really simple i feel dumb, i actually spend time trying to solve this :sweat_smile: