Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local ComponentTemplate = {}
- ComponentTemplate.__index = ComponentTemplate
- ComponentTemplate.ModuleName = "ComponentTemplate"
- function ComponentTemplate:TestFunction()
- -- put function code here
- end
- function ComponentTemplate:GetTestVariable(value, test)
- if self.testVariable < test then
- self.testVariable = value
- end
- end
- function ComponentTemplate:GetTestVariable()
- return self.testVariable
- end
- function ComponentTemplate.new(CharacterComponentInterface, ServerOnly)
- local self = {
- name = script.Name,
- characterComponentInterface = CharacterComponentInterface,
- characterModel = CharacterComponentInterface.characterModel,
- moduleConfigurationObject =
- CharacterComponentInterface.ConfigurationsObject:FindFirstChild(ComponentTemplate.ModuleName
- ),
- serverOnly = ServerOnly,
- componentVariable = 1,
- testVariable = 3,
- }
- setmetatable(self, ComponentTemplate)
- -- Register Any Configurations Added
- CharacterComponentInterface:RegisterConfigurations(ComponentTemplate.ModuleName)
- -- Register Variables
- CharacterComponentInterface:RegisterVariable("ComponentVariable",
- CharacterComponentInterface:MapGetToVariableInModule(self, "componentVariable "),
- CharacterComponentInterface:ReadOnlySetFunction("componentVariable "))
- CharacterComponentInterface:RegisterVariable("TestVariable",
- CharacterComponentInterface:MapGetToGetFunctionInModule(self, "GetTestVariable"),
- CharacterComponentInterface:MapSetToSetFunctionInModule(self, "SetTestVariable"))
- -- Register Functions
- CharacterComponentInterface:RegisterFunction("TestFunction",
- CharacterComponentInterface:MapToFunctionInModule(self, "TestFunction"))
- end
- --Remove and cleanup events
- function ComponentTemplate:delete()
- end
- return ComponentTemplate
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement