Problem with bool value on wip inventory system

Hello friends, I came to ask you for help … I really don’t know why this is happening. I set a bool value to ‘false’, but it still remains 'nil’
Code:

local MPS = game:GetService("MarketplaceService")
local UIS = game:GetService("UserInputService")
local InvOpenGui = script.Parent.Parent.Inv
local Inventory = {}
Inventory.__index = Inventory

function Inventory.new(...)
	local self = {}
	setmetatable(self, Inventory)
	local args = {...}
	
	self.Client = args[1]
	self.Frame = args[2]
	
	 self.GetSlots = function()
        if MPS:UserOwnsGamePassAsync(self.Client.UserId, 11361034) then return 8 else return 16 end
	end
	
	self.Capacity = self.GetSlots()
	self.Opened = false --still nil when called
	
	return self
end

function Inventory:OpenRequest()
	assert(self.Opened == false or self.Opened == true, 'The value is nil')
	if self.Opened == false then
		self.Opened = false
		self.Frame:TweenSize(UDim2.new(0.517, 0,0.769, 0),'Out','Quint',.1,true)
		game.Lighting.Blur.Size = 25
		
	elseif self.Opened == true then
		self.Frame:TweenSize(UDim2.new(0,0,0,0),'Out','Quint',.1,true)
		game.Lighting.Blur.Size = 0
		wait(.2)
		self.Opened = false
		end
end

UIS.InputBegan:Connect(function(input, typing)
	if not typing then
		if input.UserInputType == Enum.UserInputType.Keyboard then
			local keyPressed = input.KeyCode
			if keyPressed == Enum.KeyCode.G then
				InvOpenGui.Runn:TweenPosition(UDim2.new(0, 0,0, 0),'Out','Quint',.1,true)
				Inventory:OpenRequest()
				InvOpenGui.Runn:TweenPosition(UDim2.new(0, 0,-.1, 0),'Out','Quint',.1,true)
			end
		end
	end
end)

return Inventory

Screenshot_1

You need to use Inventory:new the keyword self does not exist when not called as a method.

You never create a Inventory before the UIS.InputBegan, so it tries to call OpenRequest on the Inventory class instead of an inventory object. If you connected to InputBegan in Inventory.new() (using self:OpenRequest()) it should work.

They defined it here:

function Inventory.new(...)
	local self = {}

Even if it defines it self is still a keyword, he’s better off using Inventory:new.

This is a module script he’s creating the inventory in another script.