hi, im working on scripting an inventory system like escape from tarkov but im really lost on what to do next. i’ve made code to generate items and containers
local module = {}
-- written by lukethebestpug, 9/23/23
local assets = script.Parent.assets
local player = game:GetService("Players").LocalPlayer
local function generategrid(x, y)
local data = {}
for i = 0, x, 1 do
for e = 0, y, 1 do
local griddata = {i,e, taken = false}
table.insert(data, griddata)
end
end
return data
end
function module.NewContainer(config:Configuration)
local ui = assets.ui[config.Name]
local container = assets.storagetemplate:Clone()
container.Name = config.Name
container.Icon.ImageLabel.Image = ui:GetAttribute("Icon")
container.Parent = assets.containers
container.Icon.label.Text = config.Name
local slotx = ui:GetAttribute("SlotSizeX")
local sloty = ui:GetAttribute("SlotSizeY")
container.Size = UDim2.new(0,357,0,100*sloty)
local slotcount = ui:GetAttribute("SlotCount")
local slots = container.Slots
local count = 1
for i = 1, slotx, 1 do
for e = 1, sloty, 1 do
local x, y = slotx*35, sloty*35
local grid = assets.Grid:Clone()
grid.Parent = container.Slots.Slot
grid.Name = tostring(count)
grid.LayoutOrder = count
count = count+1
end
end
slots.UIGridLayout.CellSize = UDim2.new(0,35*slotx,0,35*sloty)
slots.UIGridLayout.FillDirectionMaxCells = slotcount
if slotcount ~= 1 then
for i = 1,slotcount-1,1 do
local grid = container.Slots.Slot:Clone()
grid.Parent = container.Slots
end
end
slots.Slot.UIGridLayout.FillDirectionMaxCells = slotx
end
function module.NewTool(config:Configuration)
local tool = assets.item:Clone()
local actualtool = game:GetService("ReplicatedStorage"):WaitForChild("Tools"):WaitForChild(config.Name):Clone()
actualtool.Parent = tool
tool.Parent = assets.tools
tool.Name = config.Name
tool.Image = ("rbxassetid://" .. config:GetAttribute("Icon"))
tool.Size = UDim2.new(0,config:GetAttribute("SizeX")*35,0, config:GetAttribute("SizeY")*35)
end
return module
but thats it. im extremely lost on what to do next and some help would be appreciated