Best way to separate Tools into Classes

Hello,

So to seperate certain Tools from certain Classes,
(Ex: Primary, Secondary, Tertiary)

what is the best possible way to do this with Tools?


Should I:

  • Use a Folder and RemoteEvent?

  • Setup an Attribute for the Class, inside the Tool?

  • Assign Tool to a Table?


Just asking for the best Possible way to create Classes for Tools:

Event.OnServerEvent:Connect(function(plr, Class, Item) -- OnServerEvent or OnClientEvent?
-- Do i use a table?
-- Do i use a Folder?
-- Do i create a Attribute?
end)

To put it simply, I am trying to seperate Certain classes of Items, and when there is a Another Tool of the same class, i want to delete it.

If it’s only certain types of class items, without the stats of that item, you can just use attributes to store the data.

If you also want to include stats like damage, etc., it would be better to use a module script, since all you need to do is use the name of the item and identify what type of class that item is. Example:

-- Weapons
return {
    ["Classic Sword"] = {
        Class = "long sword",
        SpeedReduction = 2,
        Damage = 30,
    }

    ...
}

And if you want to check what type of class the player has to see if it should be replaced, just compare the class.

local currentAttributes = Weapons[currentTool.Name]
local newAttributes = Weapons[newTool.Name]

if currentAttributes.Class == newAttributes.Class then
    currentTool:Destroy()
    newTool:Clone().Parent = player.Backpack
end