This documentation is a Work In Progress, I will continue to update it frequently till completion.
Server
The server side version of the ServerInventory is designed to only handle data and work on server side, it has a few differences from it's client sided counterpart, Keep in mind most things from a CTool must be manually replicated through playerRecord:SendNetworkEvent().
ServerInventory [Module]
ServerInventory is a module script which is in charge of running the entirety of the code for Chicktools on server side.
Properties |
Data type |
Description |
Objects |
Dictionary |
Table containing all the object types/Classes that will go inside inventories |
Functions |
Description |
Arguments |
:Setup(server) |
Sets up all the necessary code for the mod to work, also sets up all the modules/Objects parented to the module script. |
client(Table) |
:GetPriority() |
Returns the priority of the mod |
|
:ProcessCommand(command, playerRecord) |
Recieves a custom command by a client and calls all :ProcessCommand() functions of all Objects/Classes so they can handle the commands too |
command(Table): Contains all the data sent by the client to the server such as inputs. playerRecord(Table): playerRecord of the client who sent the command. |
CTool
CTool is an Object which imitates Roblox tools, it can be created with a constructor function and can be placed into player's inventories, it can also have code be hooked into its events to perform various actions.
Object/Class
This refers to the section dedicated to the CTool object itself.
Property |
Data type |
Description |
ID |
Number |
The ID is a property which is meant to be read only, it displays an unique number created for that CTool object, it is meant to be used to find that specific CTool on a player’s inventory or the InventoryRecords. |
Owner |
Player |
Owner is a property which is meant to be read only, it displays the current Player instance who owns the CTool, to change the owner use the :SetOwner() function. |
ClassName |
String |
Read only property which displays the Classname of a CTool, this property can get changed if the CTool is a derivative class from the default CTool. |
Name |
String |
This property displays the name of a CTool, It can be changed anytime. |
Origin |
String |
This is a read only property which displays if a CTool was created on the Client or on the Server. |
Icon |
Number |
The Icon property is a property which is used to set the Icon of a CTool, make sure that you use a valid decal ID. |
IsEquipped |
Boolean |
IsEquipped is a read only property which displays the Equipped status of a CTool, false = Not equipped, true = Equipped. To change the Equipped status of a CTool use the :Equip() and :Unequip() functions. |
Function |
Arguments |
Description |
.new() |
|
.new() is a constructor function for the CTool object, it will return the CTool object created. |
:Equip() |
|
Equips the CTool object and puts it on the Backpack’s hand slot. |
:Unequip() |
|
Unequips the CTool object and removes the CTool from the backpack’s hand slot. |
:SetOwner() |
Player,Replicate
|
Puts a reference of the CTool into the owner’s playerRecord Backpack and sets the Owner property to the owner’s Player object. When the Replicate argument is passed as true it will replicate the ownership change to the Owner’s client. |
:Destroy() |
Replicate |
Removes all default references of a CTool table. When the Replicate argument is passed as true, it will also replicate the destruction of a CTool to the owner’s client. |
Event |
Parameters |
Description |
Equipped |
ActionType |
Fires when the CTool is equipped, the ActionType parameter will be true when the CTool is equipped and be false when the CTool is unequipped. |
OwnershipChanged |
UserId |
Fires when the CTool’s Owner is changed, it will also give the UserId of the new CTool Owner via the UserId parameter. |
Destroyed |
|
Fires whenever the CTool gets destroyed. |
ModuleScript
This section refers to the module script that handles the CTool objects.
Property |
Data type |
Description |
ClassName |
String |
This property determines the ClassName of CTool objects, This property should be "CTool" . |
Classes |
Dictionary |
Classes is a table which contains all the other required module scripts from classes created from the CTool class/object. |
IDCounter |
Number |
The IDCounter is a read only property which displays the ID from the latest CTool and it is used to count future CTool ID’s. |
CToolRecords |
Dictionary |
CToolRecords is a table containing all CTool objects that currently exist, they will be indexed with their ID |
Function |
Arguments |
Description |
:Setup() |
client |
|
:ProcessCommand() |
command |
|
:Step() |
client, _deltaTime
|
|
Event |
Parameters |
Description |
OnBeforeBackpackClear |
Backpack, playerRecord
|
Fires before a backpack gets cleared, it will give the Backpack of the CTool’s owner via its Backpack parameter and also give the playerRecord of the player who’s having his backpack cleared. |
Client
ClientInventory [Module]
CTool
Object/Class
Object/Class
Has this documentation been usefull so far?
- Yes
- Needs improvement/Lacks info
- No
3 Likes