If you have an array, you’ll either be using table.find or manually iterating through the table with a needle-in-the-haystack function:
local list = {"Fox", "Yeti", "Crocodile", "Pharaoh"}
local function isInArray(array, _find)
for _, value in ipairs(array) do
if value == _find then
return true
end
end
return false
end
if isInArray(list, HitParent) then
print("Rangeboss")
If it’s a dictionary, then the original if statement would work, but you just need to format it into a dictionary. You got it at some point in the responses but used table.find which should be for arrays and inverted the dictionary order.
local list = {
["Fox"] = "Block1",
["Yeti"] = "Block2",
["Crocodile"] = "Block3",
["Pharaoh"] = "Block4",
}
if list[HitParent] then
print("Rangeboss")