Multiple answer guessing game

So im making a game and i want it to have multiple answers like it would open a gate if you say “America” or “USA” (so both answers are opening it)
the or keyword doesnt work here, cuz i have multiple gates that needs to be opened.

Could you provide a script example, I believe “or” would work, if you have a lot of different valid words you could use an array instead; example below

local valid_words = {
    "America",
    "USA",
    "United States of America",
}

local function is_valid(word: string): boolean
    for _, valid in valid_words do
        if word == valid then
            return true
        end
    end

    return false
end
2 Likes

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.