Detecting inputs in a module script

So I’m making an inventory system for my game.

I decided it would be helpful if I made it OOP structured. And it actually is, but I dont know how to access inputs from my module script.

local Inventory = {}
Inventory.__index = Inventory

function Inventory.New(Player)
	local self = setmetatable({}, Inventory)
	
    self.Slots = {}
    self.MaximumSlots = 4

	return self
end

function Inventory:Open()
    --open inventory
end
	
return Inventory

Now there’s more in this script, but nothing is connected with inputs or anything like that.

So how would I be able to detect inputs on this module script AND be able to use the self keyword when calling my fucntion. (self:Open())

1 Like

if you require it using a localscript the module script will also be local so you can

local Module = require(...your module);
print(Module.Mouse)

the module

local module = {}
module.Mouse = game.Players.LocalPlayer:GetMouse() --this will work
return module

this is only a example how you can use client sided stuff if you require the module inside a localscript