Similar Users Help

How could I add a similar user warnings on users with two similar users if the argument matches more than two users just based off the first few characters?

Let’s say we have a table:

local userNames = {}

and this table contains all the usernames, how could I see if the first three letters of someones username matched someone else(s) in the table

local function getMatchingUsernames(playerName: string)
   local matching = {}
   for _, other in ipairs(Players:GetPlayers()) do
      if other.Name:sub(1, #playerName) == playerName then
          matching[#matching+1] = other.Name
      end
   end
   return matching
end

You can base it off this snippet I provided. (Specifically, you can reference the if ... then statement for your uses)

1 Like

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