I’m trying to make a developer side moderation tool and i keep geting stuk on this one thing. i am trying to make a script that pulls from a Pastebin database in the layout of this 00000,000000 (id’s added one after another in a list) that will automatically kick a player from the game if the avatar item is a match on the list.
Here is what I have so far but cant get it to work.
local HttpService = game:GetService(“HttpService”)
– Pastebin raw URL
local pastebinURL = “link” – replace with your actual Pastebin raw URL
– Function to fetch banned asset IDs from Pastebin
local function fetchBannedAssets()
local success, response = pcall(function()
return HttpService:GetAsync(pastebinURL)
end)
if success then
local bannedAssets = {}
for assetId in string.gmatch(response, "%d+") do
table.insert(bannedAssets, tonumber(assetId))
end
return bannedAssets
else
warn("Failed to fetch banned assets: " .. tostring(response))
return {}
end
end
– Function to check if a player is wearing any of the banned assets
local function isWearingBannedAsset(player, bannedAssets)
local humanoidDescription = player.Character:WaitForChild(“Humanoid”).HumanoidDescription
local function checkAccessories(accessoryIds)
for _, assetId in pairs(bannedAssets) do
for _, id in pairs(accessoryIds) do
if tonumber(id) == assetId then
return true
end
end
end
return false
end
local accessoryTypes = {
humanoidDescription.HatAccessory,
humanoidDescription.FaceAccessory,
humanoidDescription.NeckAccessory,
humanoidDescription.ShouldersAccessory,
humanoidDescription.FrontAccessory,
humanoidDescription.BackAccessory,
humanoidDescription.WaistAccessory
}
for _, accessory in pairs(accessoryTypes) do
if checkAccessories(string.split(accessory, ",")) then
return true
end
end
local clothingTypes = {
humanoidDescription.Shirt,
humanoidDescription.Pants,
humanoidDescription.ShirtGraphic
}
for _, clothing in pairs(clothingTypes) do
for _, assetId in pairs(bannedAssets) do
if tonumber(clothing) == assetId then
return true
end
end
end
return false
end
– Function to handle player joining
local function onPlayerAdded(player)
player.CharacterAdded:Connect(function(character)
– Wait for the character to be fully loaded
character:WaitForChild(“Humanoid”)
character:WaitForChild(“HumanoidDescription”)
local bannedAssets = fetchBannedAssets()
if isWearingBannedAsset(player, bannedAssets) then
player:Kick("You are wearing a restricted item.")
end
end)
end
– Connect the function to the PlayerAdded event
game.Players.PlayerAdded:Connect(onPlayerAdded)
I got this working for backlisted player and groups. here is an example for the group band script
local HttpService = game:GetService(“HttpService”)
– Pastebin raw URL
local pastebinURL = “link” – replace with your actual Pastebin raw URL
– Function to fetch banned group IDs from Pastebin
local function fetchBannedGroups()
local success, response = pcall(function()
return HttpService:GetAsync(pastebinURL)
end)
if success then
local bannedGroups = {}
for groupId in string.gmatch(response, "%d+") do
table.insert(bannedGroups, tonumber(groupId))
end
return bannedGroups
else
warn("Failed to fetch banned groups: " .. tostring(response))
return {}
end
end
– Function to check if a player is in any of the banned groups
local function isInBannedGroup(player, bannedGroups)
for _, groupId in pairs(bannedGroups) do
if player:IsInGroup(groupId) then
return true
end
end
return false
end
– Function to handle player joining
local function onPlayerAdded(player)
local bannedGroups = fetchBannedGroups()
if isInBannedGroup(player, bannedGroups) then
player:Kick(“You are in a banned group.”)
end
end
– Connect the function to the PlayerAdded event
game.Players.PlayerAdded:Connect(onPlayerAdded)
any ideas on how to fix it