VERY UNFINISHED CODE!! though what you see here - i’ll use the same principle for everything else if there’s nothing wrong
EDIT: fuhh i also forgot to remove repeating parts
local _services = {
Server = game:GetService("ServerStorage")
} --> [ going to add more services later on. if needed. maybe. ] <--}
local Pattern: { { [string]: any } } = {
{
["tipazh"] = "Offensive" :: string,
["attack"] = "Pierce" :: string,
["animation"] = 1234567890 :: number
},
{
["tipazh"] = "Defensive" :: string,
["animation"] = 0987654321 :: number
}
}
return function(plr: Player, name: string): (Player, string) -> any | { [string]: () -> any }
local card: Configuration = _services.Server.Cards:FindFirstChild(name)
if not card then
return error(("Card '%s' not found."):format(name))
end
local confAttributes: { any } = card:GetAttributes()
return {
MuhAttributes = function()
local card: Configuration = _services.Server.Cards:FindFirstChild(name)
if not card then
return error(("Card '%s' not found."):format(name))
end
for _, attribute: string in string.split(confAttributes["attributes"], "|") do
local result: ModuleScript = _services.Server.Attributes:FindFirstChild(attribute)
if not result then
continue
end
print(attribute) --> [ for debugging purposes ] <--
require(result)(plr)
end
end
}
end
this is pretty barebones but i just wanna know beforehand, since i kinda don’t want the performance to die
any criticism is welcome as long as it’s actual criticism and not just hate!
also this code is not going to be seen by anyone else because there’s only 2 people in my “dev team” (me and my friend, he’s a builder)
forgot to say, this is for a single-player game, so most likely not very secure