local unavailableAccessories = require(game:GetService("ServerScriptService").UnavailableAccessories)
local function check(v)
for i, b in unavailableAccessories do
if v.name:find(unavailableAccessories[i]) then
print(v.name, unavailableAccessories[i])
return false
end
end
return true
end
(UnavailableAccessories module script down here)
local unavailableAccessories = {
"[ Content Deleted ]", -- > any item which is deleted
"International Fedora", -- > any international fedora
"Roblox Baseball Cap", -- > Hat
"Medieval Hood of Mystery", -- > Hat
-- > and the list goes on...
I have this function that tries to compare accessorys name to all the forbidden patterns which I stored in a module script (UnavailableAccessories), if founds a pattern it returns false, else if for loop didn’t bring any results then function will return true, but for some reason after all of my checks with print() command it seems like that all it does is that it compares accessorys name only to the first pattern and for some odd reason does find a pattern in it even though as far as I know it’s completely wrong
ex: founds “[ Content Deleted ]” string pattern in “Wolf & Moon” string
I tried seems like everything but I just can’t come up with any solution
local unavailableAccessories = require(game:GetService("ServerScriptService").UnavailableAccessories)
local function check(checkFor)
if table.find(unavailableAccessories, checkFor) then
-- Found in table
return false
end
return true
end
I’m not sure but I’ll explain my position here and why I’m not using table.find or just compare two values:
There’s this accessory named Internation Fedora, and there’s like over 50+ variations of this hat. To make my table with forbidden accessories cleaner I want to make it find a pattern, so if it will find a sentence (ex: “Internation Fedora”) in it, script will automatically detect it without need to manually write all variations in a table (and I don’t know but I think this way will somehow optimize the game, I’m not too sure)
local unavailableAccessories = require(game:GetService("ServerScriptService").UnavailableAccessories)
local function check(checkFor)
for _, name in unavailableAccessories do
if string.find(checkFor.name, name) then
return true -- Found in list
end
end
return false -- I swapped these around because it doesn't make sense to return true when you don't find anything
end