I need some help with OOP… I’m a beginner at this and I need some help with it. Basically, i have a “.new” function that creates a new instance:
function bolt.new()
local newbolt = {}
newbolt.variables = {
["services"] = variablesservices
}
setmetatable(newbolt, bolt)
return newbolt
end
Then, I have this “:getservices” function that retrieves the self.variables.services from the “.new” function:
function bolt:getservices()
return self.variables.services
end
And I also have a test script (to test the .new and :getservices functions) which is a server script:
local bolt = require(game.ReplicatedStorage:WaitForChild("Bolt").Bolt)
local newbolt = bolt.new()
print(newbolt:getservices())
Which works great but here’s the problem: The autocomplete lets me call :getservices off of both the new instance and the module itself. I dont want that. I only want to be able to call it from the new instance since this is a ressource for beginners i am working on and I dont want them to call the functions from the wrong places. Did I write something wrong? Help would be appreciated!