✓ Accepted answer
We use what is called accessors and mutators ie get data (read only) set data (validate then set copy) this is the basics of OOP.
An example would be :-
local vars = {}
local f = {}
local get = {}
local set = {}
vars.a = true
function get.getA()
return vars.a
end
function set.setA(val)
if typeof(val) == 'boolean' then
vars.a = val
end
end
function f.printA()
print('a is', vars.a)
end
return {get = get, set = set, f = f}
Script:-
local module = require(script.Parent.ModuleScript)
local get, set, f = module.get, module.set, module.f
print(get.getA())
f.printA()
set.setA('Hi')
f.printA()
set.setA(false)
f.printA()
print(get.getA())
Working with private modules can be difficult as allowing the user to input data can leave it vunrable so you should test for this.
I hope this helps