How to get unique values in an array?

So, I wasn’t sure how to word the title but here goes.

Let’s say I have a list.

Let’s say I also have an unknown amount of unique values. Let’s say I have 5 unique values (A,B,C,D,E)

Now let’s say I have a list of those unique values and they are jumbled up and some are repeated.
Like this
(A,D,B,E,B,A,C,C,E,B,D,D,A)

How would I get a list that only contains unique values?

The values are not numeric and they do not have to be in A,B,C,D,E order.

I am looking for a formula or a function that can do this. Thanks.

Hello,

You would have to use a https://education.roblox.com/en-us/resources/pairs-and-ipairs-intro loop to go through the array and use Control Structures | Roblox Creator Documentation to find the value you are looking for.

Let me know how it goes!

this is really easy to do

local TestTable = {
    "A",
    "B",
    "B",
    "A",
    "C",
    "C"
}

function GetUniqueTable(Table)
    local EndTable = {}
    for i, v in pairs(Table) do
        if not table.find(EndTable, v) then
            table.insert(EndTable, v)
        end
    end
    return EndTable
end

GetUniqueTable(TestTable)

ik you deleted your post, but what was the point of redefining the global variable “in” to false?

different name would’ve been better

I deleted it because it was unnecessary. Your solution was better🤷‍♂️ honestly forgot everything inside as soon as I pressed delete.