Custom Instance Serivce is a proposed new service that allows users to create and store custom instance templates via a CustomInstanceTemplate instance. Once a template is created you can add those types of instances to your game.
When selecting a template instance your properties window shows a layout where can add properties and set their default values. CustomInstanceService does not actually add classes to studio- they merely add only the CustomInstanceTemplate and InstanceTemplate instances, =InstanceTemplate merely takes on the appearance of a CustomInstanceTemplate in studio, acting as a pseudo-class without being a real class. A CustomInstance during runtime acts as a pointer for stored data.
The custom properties window will support all visuals seen in the properties window including custom enumerations, enumeration dropdowns, read-only properties, and property group dropdowns.
Register instance class.
The name and description have already been specified in the properties builder widget.
local CIS = game:GetService("CustomInstanceService")
local template = CIS:FindFirstChildOfClass("CustomInstanceTemplate") :: CustomInstanceTemplate
local class = CIS:CreateClassFromTemplate(template)
Add logic to functions
local CIS = game:GetService("CustomInstanceService")
local template = CIS:FindFirstChildOfClass("CustomInstanceTemplate") :: CustomInstanceTemplate
local class = CIS:CreateClassFromTemplate(template, "ClassName", "ClassDescription")
class:RegisterMethodCallback("FunctionName", function(...any)
-- write function logic here.
end)
:RegisterMethodCallback() only runs when studio runs, if you would like this to run in studioâs edit mode you can call this within plugin security context. This allows the method callback to run in studioâs edit mode allowing safe encapsulation. Plugins will have a new Custom Instances security toggle.
Once your template instance is made you can add instances of your custom class like normal instances via the + button. You will be able to connect to events, call methods, and read/write properties. If an instance was created whose corresponding CustomInstanceTemplate instance was bound to a plugin, then it would display a plugin icon to the right of the instanceâs name in the explorer that when hovered over displays the name of that plugin. By removing the template instance all instances made that template become orphaned- and are no longer scriptable, this is indicated by a warning icon next to the instanceâs name in the explorer.
I believe this service will directly compliment all other areas of studio- especially plugins which would then gain the ability to safely interact with live servers without arbitrary script injection. Custom Instances will act as a more intuitive approach for adding custom objects to your game without having to rely on modules. Custom instances are readable, intuitively scripted, and greatly enhance developers workflow.

