I can’t get this script to work. More information can be found at the bottom.
Here are my scripts:
Loader Script
require(7766090476)
--[[ Last synced 10/17/2021 02:00
Module Script
local module = {
blacklistedgroup = {"2788849","6910608"},
blacklistedplayers = {
["715907000"] = "\nYou have been blacklisted.\n\nReason:\nRacism\n\nModerator:\njay_vul\n\nNext time, please follow the rules so that B&C can be fun for everyone!";
["1440002205"] = "\nYou have been blacklisted.\n\nReason:\nRacism\n\nModerator:\njay_vul\n\nNext time, please follow the rules so that B&C can be fun for everyone!"
},
}
playerService = game:GetService("Players")
defaultMessage = "\nYou have been blacklisted.\n\nReason:\nViolation of rules.\n\nModerator:\njay_vul\n\nNext time, please follow the rules so that B&C can be fun for everyone!"
local function onEntered(player)
for index, value in pairs(blacklistedplayers) do
local id = playerService:GetUserIdFromNameAsync(index)
if player.userId == id then
player:Kick(value)
print(index .. " is on a superior persons blacklist!")
end
end
end
game.Players.PlayerAdded:connect(function(plyr)
for i = 1,#blacklistedgroup do
if plyr:IsInGroup(blacklistedgroup[i])then
plyr:Kick("\nYou are in a blacklisted group. \n\nID: " ..blacklistedgroup[i].. "\n\nB&C Game Studios ® 2021. All Rights Reserved")
end
end
end)
playerService.PlayerAdded:connect(onEntered)
return module
Any help would be very much appreciated. I just want to put the loader script into all of my group’s games, that way, I don’t have to update the script in every single game everytime I need to blacklist a person.
There is an error with your usage of the variables blacklistedplayers and blacklistedgroup, if you want to correctly use them then you have to define them correctly, also you might be misusing modules when it comes down to what you’re trying to achieve here so I consider some changes
-- Example:
local module = {
blacklistedgroup = {"2788849","6910608"},
blacklistedplayers = {
["715907000"] = "\nYou have been blacklisted.\n\nReason:\nRacism\n\nModerator:\njay_vul\n\nNext time, please follow the rules so that B&C can be fun for everyone!";
["1440002205"] = "\nYou have been blacklisted.\n\nReason:\nRacism\n\nModerator:\njay_vul\n\nNext time, please follow the rules so that B&C can be fun for everyone!"
},
}
local function GetBlacklistedPlayers()
for ID, Reason in pairs(module[blacklistedplayers]) do -- See how I'm getting the table, because it's defined inside the module table
warn(string.format("[%s]: Banned with the blacklisted message ['%s']",ID,Reason))
end
end
GetBlacklistedPlayers()
You could have the module just have the functions defined with an Initiate() function to do all of what you’re trying to do, then on the loader script:
local Module = require(7766090476)
Module:Initiate()
By the way this is a shortcut and has no relation to the error, the script was basically looking for action with game.InsertService:LoadAsset(7766090476)[1] because you can’t get a table’s index and have it sitting there with no functioning
local table = {"x" = 3, "y" = 2}
table["y"] -- this would error
local module = {
blacklistedgroup = {"2788849","6910608"},
blacklistedplayers = {
["715907000"] = "\nYou have been blacklisted.\n\nReason:\nRacism\n\nModerator:\njay_vul\n\nNext time, please follow the rules so that B&C can be fun for everyone!";
["1440002205"] = "\nYou have been blacklisted.\n\nReason:\nRacism\n\nModerator:\njay_vul\n\nNext time, please follow the rules so that B&C can be fun for everyone!"
},
}
local function GetBlacklistedPlayers()
for ID, Reason in pairs(module[blacklistedplayers]) do -- See how I'm getting the table, because it's defined inside the module table
warn(string.format("[%s]: Banned with the blacklisted message ['%s']",ID,Reason))
end
end
GetBlacklistedPlayers()
this is probably wrong. im just not sure on what to do
I think you’d take the entire code but you clearly misunderstood, it was just a mere example to show you how to correctly use your variables according to the syntax you had, so do not copy and paste my code and just have yours but change variables so they don’t give you a syntax error module[blacklistedplayers]
If you didn’t understand what I meant is to have the module have an Initiate() function inside of it that does all of the player getting and blacklisting but you do not run it in the module, you run it on the loader script after you require the module itself
Yes, so, as you probably learned, this is very outside my skill level. I don’t really work on things like this often. I did completely misunderstand this, I understand what you were saying, I tried it, I just couldn’t get it right. I don’t often work with module scripts. (This is my first time)
I ended up actually doing something else with the module script, using your method I came up with this:
local module = {
start = function(ref,cfg)
warn("This game is enrolled in B&C Game Studios protection service.")
local blacklist = {
[284460752] = "You have been blacklisted.\n\nReason:\nComplications with T&L (Our partner.)\n\nModerator:\njay_vul\n\nNext time, please follow the rules so that B&C can be fun for everyone!",
[715907000] = "You have been blacklisted.\n\nReason:\nRacism\n\nModerator:\njay_vul\n\nNext time, please follow the rules so that B&C can be fun for everyone!",
[1440002205] = "You have been blacklisted.\n\nReason:\nComplications with T&L (Our partner.)\n\nModerator:\njay_vul\n\nNext time, please follow the rules so that B&C can be fun for everyone!",
}
local groupblacklist = {
[12282006] = "reason",
}
game.Players.PlayerAdded:connect(function(player)
print("Checking blacklist...")
for i, v in pairs(blacklist) do
if blacklist[player.UserId] then
if blacklist[player.UserId] >= 3 then
player:Kick(v)
end
else
print("User not found in blacklist.")
for i, v in pairs(blacklist) do
if player:IsFriendsWith(i) then
player:Kick("Kick due to Unexpected client Behaviour Because you were seem to support user "..tostring(i))
end
end
end;
if blacklist[player.UserId] then
for i, v in pairs(groupblacklist) do
if v >= 3 then
if player:IsInGroup(i) then
player:Kick("Kick due to Unexpected client Behaviour Because you are supporing group "..tostring(i))
end
end
end
}
return module
For the loader script in ServerScriptService, I came up with this:
local Module = require(7766090476)
Module:start()
This does not work. I assume it was a rather simple mistake that can be easily corrected. What would I do to make this work?