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