Basically, I have a really long if statement below can be found a really old save a copy of that I found
if CosmeticName == "A" or CosmeticName == "B" or CosmeticName == "C" or CosmeticName == "D" or CosmeticName == "E" or CosmeticName == "F" or CosmeticName == "G" or CosmeticName == "H" or CosmeticName == "I" or CosmeticName == "J" then
Is there a way to make this code any tidier and cleaner and not so long but to still do the same task?
maybe change the CosemticName to CN so its gonna be like
if CN == "A" or CN == "B" or CN == "C" or CN == "D" or CN == "E" or CN == "F" or CN == "G" or CN == "H" or CN == "I" or CN == "J" then
or maybe use some kind of table probably?
You can put the names in a table and use table.find instead
Example
local CosmeticNames = {
"A",
"B",
--And so on
}
if table.find(CosmeticNames,"B") then
print("Found the Cosmetic Name in the table")
end
Perfect! Just what I was looking for, thanks!
1 Like
Imagine just reading this in #resources:community-tutorials then finding this here immediately.
Wait… i just noticed that the tutorial was by you too 
1 Like