local HttpService = game:GetService("HttpService")
local RunService = game:GetService("RunService")
local Players = game:GetService("Players")
local boardID = "redacted"
local whitelistLID = "redacted"
local trelloapikey = "redacted"
local whitelist = {
--"Alex_Google214"
}
local wlb = {}
for _,v in ipairs(whitelist) do
table.insert(wlb,v)
end
--if RunService:IsStudio() then
-- return "Not checking whitelist, player is in Studio"
--end
kickReasons = {}
kickReasons["notWhitelisted"] = "\n👋\n\n[ENG] Not Whitelisted. Goodbye.\n---\n[RU] Не в белом списке. До свидания.\n---\n[AZ] Ağ siyahıda deyilsiniz. Sağolun.\n---\n[DE] Sie sind nicht auf der Whitelist. Auf Wiedersehen."
kickReasons["kicked"] = "\n👋\n\n[ENG] You just got kicked. Goodbye.\n---\n[RU] Вас выгнали. До свидания.\n---\n[AZ] Siz indicə serverdən qovuldunuz. Sağolun.\n---\n[DE] Sie wurden gerade vom Server geworfen. Auf Wiedersehen."
kickReasons["be gone"] = "be gone"
local function lowercaseAllLists()
-- whitelist
local temp = {}
for i,v in ipairs(whitelist) do
table.insert(temp, string.lower(v))
end
whitelist = {}
for i,v in ipairs(temp) do
table.insert(whitelist, string.lower(v))
end
--wlb
temp = {}
for i,v in ipairs(wlb) do
table.insert(temp, string.lower(v))
end
wlb = {}
for i,v in ipairs(temp) do
table.insert(wlb, string.lower(v))
end
temp = {}
end
local function refreshWhitelist()
whitelist = {}
-- manual whitelist copy
for _,v in ipairs(wlb) do
table.insert(whitelist,v)
end
-- trello whitelist
local data
local success, response = pcall(function()
local response = HttpService:GetAsync("https://api.trello.com/1/lists/"..whitelistLID.."/cards?key="..trelloapikey)
data = HttpService:JSONDecode(response)
end)
if not success then
warn("Error: "..response)
end
for _,card in ipairs(data) do
table.insert(whitelist,card.name)
end
lowercaseAllLists()
print("Refreshed whitelists.")
end
refreshWhitelist()
game:GetService("Players").PlayerAdded:Connect(function(player)
if not table.find(whitelist,string.lower(player.Name)) then
player:Kick(kickReasons["notWhitelisted"])
end
player.Chatted:Connect(function(message)
if player.Name == "Alex_Google214" then
if string.sub(string.lower(message),1,4) == "/rwl" or string.sub(string.lower(message),1,18) == "/refresh whitelist" or string.sub(string.lower(message),1,17) == "/reload whitelist" then
refreshWhitelist()
elseif string.sub(string.lower(message),1,8) == "bе gone" or string.sub(string.lower(message),1,13) == "/refresh user" then -- be gone - the "e" in "be" is russian E
for i,plr in ipairs(game:GetService("Players"):GetChildren()) do
if not table.find(whitelist,string.lower(plr.Name)) then
if string.sub(string.lower(message),1,7) == "bе gone" then
plr:Kick(kickReasons["be gone"])
else
plr:Kick(kickReasons["notWhitelisted"])
end
end
end
elseif string.sub(string.lower(message),1,11) == "/e kicktool" or string.sub(string.lower(message),1,5) == "/e kt" or string.sub(string.lower(message),1,3) == "/kt" then
local Alex = Players:FindFirstChild("Alex_Google214")
if not Alex then return end
local Tool = Instance.new("Tool", Alex.Backpack)
Tool.Name = "Hammer"
local a = Tool.Activated:Connect(function(mouse)
if not mouse.Hit then return end
local target = mouse.Hit:FindFirstAncestorOfClass("Model")
if not target or not target:FindFirstChild("Humanoid") then return end
if not Players:GetPlayerFromCharacter(target) then return end
Players:GetPlayerFromCharacter(target):Kick(kickReasons["kicked"])
end)
Tool:Destroy()
end
end
end)
end)
I have two functions; their main task is to refresh the whitelist when I run the command /rwl or /reload whitelist. The problem is that player.Chatted is not working sometimes. I tried putting print(message)
in
player.Chatted:Connect(function(message)
-- here
end)
^ Still didn’t work. I didn’t put this in bug reports because I am not 100% sure that there’s no bug in the code. Help will be appreciated.