I am making a game with trading cards, and I am making a table for all of the cards, but the second thing in the table always has an error and I have no idea why
local cards = {
{id = 1, name = "Fire Dragon", attack = 3000, defense = 2500},
{id = 2, name = "Water Serpent", attack = 2500, defense = 2000},
{id = 3, name = "Earth Golem", attack = 2000, defense = 3000},
}
local card = cards[2]
print(card.name, card.attack, card.defense)
---------------------------
local cards = {
{1, "Fire Dragon", 3000, 2500},
{2, "Water Serpent", 2500, 2000},
{3, "Earth Golem", 2000, 3000},
}
print(cards[1][2])
print(cards[1][3])
print(cards[1][4])
print(cards[2][2])
print(cards[2][3])
print(cards[2][4])
for index, card in ipairs(cards) do
if card[2] == "Water Serpent" then
print(index)
print(card[3])
print(card[4])
end
end
bro, pls screenshot the error and post it
I fixed it, don’t even know what I did but I fixed it.