I’m not sure why it can’t find the player in the WHITELIST usernames table.
I’m printing the table and it’s there.
Any help is appreciated!
Table:
basic.Configuration = {
VERSION = "2.4.2";
PREFIX = ":";
THEME = {
Red = 255;
Green = 0;
Blue = 0;
};
WHITELIST = {
Enabled = true;
Message = "The server is whitelisted!";
Usernames = {
{"81Frames", "Username", "Username"};
};
};
BLACKLIST = {
Usernames = {
{"Username", "Username", "Username"};
};
UserIds = {
{0000000000, 0000000000, 0000000000};
};
};
MODERATORS = {
ModUsers = {"Username", "Username", "Username"};
ModIds = {0000000000, 0000000000, 0000000000};
AdminUsers = {"Username", "Username", "Username"};
AdminIds = {0000000000, 0000000000, 0000000000};
SuperadminUsers = {"Username", "Username", "Username"};
SuperadminIds = {0000000000, 0000000000, 0000000000};
OwnerUser = {"Username", "Username", "Username"};
OwnerId = {0000000000, 0000000000, 0000000000};
};
Main script:
local moduleConfig = require(script.Parent.Parent.Parent["Basic Moderation Tools Pro"])
local configuration = moduleConfig.Configuration
local api = require(script.Parent["api"])
local starterGui = game.StarterGui["3.0 StarterGui"]
local replicatedStorage = game.ReplicatedStorage["3.0 ReplicatedStorage"]
if configuration.WHITELIST.Enabled then
api:Log("[ "..os.date("%H:%M:%S", os.time()).." ][✓][INFO][SERVER] This server is whitelisted.", "log")
end
game.Players.PlayerRemoving:Connect(function(plr)
end)
game.Players.PlayerAdded:Connect(function(plr)
if configuration.WHITELIST.Enabled then
if api:IsUserWhitelisted(plr) then
else
api:Kick(plr, configuration.WHITELIST.Message)
end
end
if api:IsOwner(plr) then
api:Rank(plr.Name, 4)
end
api:Log("[ "..os.date("%H:%M:%S", os.time()).." ][✓][INFO][CLI] "..api:GetRole(plr.Name).." @"..plr.Name.." joined the game.", "log")
plr.Chatted:Connect(function(msg)
end)
end)
Module script:
local moduleConfig = require(script.Parent.Parent.Parent["Basic Moderation Tools Pro"])
local configuration = moduleConfig.Configuration
local moderators = configuration.MODERATORS
local api = {}
function api:IsOwner(plr)
local creatorId = game.CreatorId
if plr.UserId == creatorId then
return true
else
return false
end
end
function api:IsTargetValid(target)
local target = game.Players:FindFirstChild(target.Name)
if target then
return true
else
return false
end
end
function api:IsUserWhitelisted(name)
if api:IsTargetValid(name) then
if table.find(configuration.WHITELIST.Usernames, name.Name) then
print("true")
return true
else
print("false")
return false
end
end
end
return false
Output: