SHARE
TWEET

CompTemplate

Quoteory Dec 14th, 2019 89 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. local ComponentTemplate = {}
  2. ComponentTemplate.__index = ComponentTemplate
  3. ComponentTemplate.ModuleName = "ComponentTemplate"
  4. function ComponentTemplate:TestFunction()
  5. -- put function code here
  6. end
  7. function ComponentTemplate:GetTestVariable(value, test)
  8. if self.testVariable < test then
  9. self.testVariable = value
  10. end
  11. end
  12. function ComponentTemplate:GetTestVariable()
  13. return self.testVariable
  14. end
  15. function ComponentTemplate.new(CharacterComponentInterface, ServerOnly)
  16. local self = {
  17. name = script.Name,
  18. characterComponentInterface = CharacterComponentInterface,
  19. characterModel = CharacterComponentInterface.characterModel,
  20. moduleConfigurationObject =
  21. CharacterComponentInterface.ConfigurationsObject:FindFirstChild(ComponentTemplate.ModuleName
  22. ),
  23. serverOnly = ServerOnly,
  24. componentVariable = 1,
  25. testVariable = 3,
  26. }
  27. setmetatable(self, ComponentTemplate)
  28. -- Register Any Configurations Added
  29. CharacterComponentInterface:RegisterConfigurations(ComponentTemplate.ModuleName)
  30. -- Register Variables
  31. CharacterComponentInterface:RegisterVariable("ComponentVariable",
  32. CharacterComponentInterface:MapGetToVariableInModule(self, "componentVariable "),
  33. CharacterComponentInterface:ReadOnlySetFunction("componentVariable "))
  34. CharacterComponentInterface:RegisterVariable("TestVariable",
  35. CharacterComponentInterface:MapGetToGetFunctionInModule(self, "GetTestVariable"),
  36. CharacterComponentInterface:MapSetToSetFunctionInModule(self, "SetTestVariable"))
  37. -- Register Functions
  38. CharacterComponentInterface:RegisterFunction("TestFunction",
  39. CharacterComponentInterface:MapToFunctionInModule(self, "TestFunction"))
  40. end
  41. --Remove and cleanup events
  42. function ComponentTemplate:delete()
  43. end
  44. return ComponentTemplate
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top