Here I have this table, and a script that will check the players stats to see if they meet the conditions I have put in the table using a for loop.
Whats supposed to happen is that if the player meets ALL conditions, it will print out “Conditions Cleared” but my issue is that if the player only meets ONE condition, it will still print out
My question is how do I make a for loop check every table so that the player must have all conditions checked for the print statement to run
module.Recipies = {
["Exalted"] = {
Name = "Exalted",
Energy = 50,
Runes = {
[1] = {Rune = "Temporal", Ammt = 500},
[2] = {Rune = "Larimar", Ammt = 50},
[3] = {Rune = "Sugilite", Ammt = 10},
}
},
}
function module.Craft(plr, stat)
local energy = plr.Data.Crafting.Energy
local stat = module.Recipies[stat]
if energy.Value >= stat.Energy then
for i, v in ipairs(stat.Runes) do
if v.Ammt <= plr.Data.Runes[v.Rune].Value then
print("Conditions Cleared")
end
end
end
end