I’m trying to make a ban/group ban/whitelist script that uses 1 modulescript and tables in that module script to make the list just in 1 script and not spread across multiple, but it doesn’t work but it doesn’t throw any errors either, if anyone more familiar with module scripts can correct anything I’d be happy
MODULE
local Lists = {}
local Bans = {}
local Allowlist = {}
local Blacklist = {}
Bans.Players = {
[uid] = "reason";
Bans.Groups = {
[groupid] = groupid;
}
Bans.WatchlistGroups = {
-- [group id] = group id (again), watchlist code
[0] = 0, 1;
}
Allowlist.Players = {
[uid] = uid;
}
Blacklist.Players = {
[uid] = "reason";
}
function Lists.CheckAllowlist(uid)
user = table.find(Allowlist.Players, uid)
return user
end
function Lists.CheckBlacklist(uid)
user = table.find(Blacklist.Players, uid)
return user
end
function Lists.CheckBan(uid)
user = table.find(Bans.Players, uid)
return user
end
function Lists.CheckGroupBan(gid)
group = table.find(Bans.Groups, gid)
return group
end
function Lists.CheckWatchlist(gid)
group = table.find(Bans.WatchlistGroups, gid)
return group
end
function Lists.RtnGroupTable()
return Bans.Groups
end
function Lists.RtnWatchlistTable()
return Bans.WatchlistGroups
end
return Lists
BANS SCRIPT
local Bans = require(script.Parent.Lists)
local WatchlistEvent = game.ReplicatedStorage.Watchlist
game.Players.PlayerAdded:Connect(function(plr)
for _, group in pairs(Bans.RtnGroupTable()) do
if plr:IsInGroup(group) then
local GroupInfo = game:GetService("GroupService"):GetGroupInfoAsync(group)
plr:Kick("in a banned group")
end
end
if Bans.CheckBan(plr.UserId) then
plr:Kick("banned")
end
for _, group in pairs() do
if plr:IsInGroup(group) then
local GroupInfo = game:GetService("GroupService"):GetGroupInfoAsync(group)
if GroupInfo.Id ~= 0 then
WatchlistEvent:FireClient(plr, GroupInfo.Name, Bans.RtnWatchlistTable()[1])
end
end
end
end)
WHITELIST SCRIPT
local AllowList = require(script.Parent.Lists)
game.Players.PlayerAdded:Connect(function(plr)
if script.Whitelist.Value == true then
if script.DevSite.Value == true then
if plr:GetRankInGroup(groupid) <= 252 then
if AllowList.CheckAllowlist(plr.UserId) then else
plr:Kick("whitelist")
end
end
else
if plr:GetRankInGroup(groupid) <= 2 then
if AllowList.CheckAllowlist(plr.UserId) then else
plr:Kick("whitelist")
end
end
end
end
end)