I was just wondering if it was possible to actually make your own method/function. For example: I could make my own :GetProperties() thing. I just wanted to know what I should learn to be able to do this. And whether it's actually possible. Thanks in advance
You can create your own metatables emulating this behavior.
Create a ModuleScript, in it write:
local Module = {} function Module.new(age) -- Age is an example parameter -- This new function will return a Module object -- And this function works as a constructor for this Module object local self = setmetatable({}, Module) self._age = age return self end function Module:GetAge() return self._age end return Module
:GetAge()
method returns the current value of the _age property of the initialized Module object. As you can see, it uses a colon, which is a shorthand for .GetAge(self)
(note the period instead of a colon). It's basically syntactic sugar.
Remember to accept the answer if is it helpful for you! I'm glad to help :)