Issue with making a banning player system

I am trying to make a ui that shows a player their banned from the game from the developers in the game controlling it so it will be if you join your banned from each server we will control it in Roblox studio But I have a issue a person will just change their name for 1000 robux and it will ignore the ban So I need like userId ones but im not to sure how to do that.

Code:

local module = {“Test1”,“Test2”,“Blah”,“Blah”,“Blah”,“”,“”,“”} --Not userids so they can change their username

function module:CheckWhitelist(plr)
local iswhitelisted = false
for i,users in pairs(module) do
if users == plr then
iswhitelisted = true
end
end
return iswhitelisted
end
return module

Okay so you want to check if the player’s UserId is the same as one in the table, so what you do is:

if module[player.UserId] then
   player:Kick("Banned: " .. tostring(module[player.UserId])) -- The second part is the reason of the ban
end

This only works for something like this

{[UserId] = ReasonOfBan} -- format of the table
local m = {[1] = "Roblox sucks!"} -- example of the table
m[1] = "Roblox sucks!" -- example of how you add a value to the table
m[1] = nil -- example of how you would remove values

The method you use would require:

if table.find(module, player.UserId) then
   player:Kick("Banned.")
end

Because the way you store data is like so:

{UserId} -- format of the table
local m = {1} -- example of the table
table.insert(m, 1) -- example of how you add a value to the table
if table.find(m, 1) then table.remove(m, table.find(1)) end -- example of how you would remove values

So you would need to use the method on the bottom, instead if you would like to use the method on top you would need to rewrite parts of your code.

What parts will need to be edited