Grid Type Inventory

Please don’t leave us for another year :sob:

1 Like

No, I’m still working on it. Just setting up an example project before release!

3 Likes

This is a super nice system! Glad you’re still working on it!

2 Likes

I’ve now released GridPack on Github as an alpha. Download it over there if you want to try it!

No guides or documentation has been created yet but it should arrive later. The example project still needs some fixing before i release that too but feel free to play around with the module for now!

Please create an issue if you find any bugs or want to suggest anything!

2 Likes


uh


Got it to work by adding nil checks, I like the progress you’ve got but there’s still some fixes to be made (Drag and then interact again)
grafik

Yeah this is the reason why it’s in alpha. But how did you get the example project, that shouldn’t be out yet or did I upload the wrong rbmx file?

Oh nvm it seems you have copied the code directly from the GitHub source. Use the rbxm file I provided in the releases tab, I made a little guide in the readme! (Releases tab is on the right side)

I did but It’s missing some files so I had to import them from the github

I’ve now added some guides to follow on the GitHub! You shouldn’t have to import any missing files it should just be the gridpack.rbxm file. If you imported the files from the test folder then you imported the example project which isn’t finished and is why you were having problems.

3 Likes

Hey There! I was wondering, why is there no releases in the releases.

I’ve published a pre-release version so it doesn’t show up on the main page but pressing releases shows it for me. It should be public but I’m not sure. Have the link anyway: Release Release v0.1.0-alpha · Frexsim/grid-pack · GitHub

2 Likes

would you mind providing an rbxl? i find setting this up a huge hassle

I copied the client code 1:1 from the README.md in the GitHub, and the transfer link does not seem to work. Any ideas?

Please post your code so that I can take a look at it!

1 Like

This is put inside a local script under screengui. (Also, would be nice if the DevForum would work properly and stop giving me errors, lol!)

local GridPack = require(game:GetService("ReplicatedStorage").Packages.GridPack)

local screenGui = Instance.new("ScreenGui")
screenGui.Name = "GridPack"
screenGui.ResetOnSpawn = false
screenGui.Parent = game:GetService("Players").LocalPlayer.PlayerGui

local grid = GridPack.createGrid({
	Parent = screenGui, -- Parent of the grid container

	Visible = true, -- If the grid is visible, changes the containers visible property. Also disables item interaction on all items inside.
	GridSize = Vector2.new(8, 15), -- How many slots the grid has on the X and Y axes.
	SlotAspectRatio = 1, -- Aspect ratio of one slot in the grid, helps with different resolutions if you're using scale instead of offset.

	AnchorPoint = Vector2.new(0, 0.5), -- Anchor point of the grid container
	Position = UDim2.new(0, 20, 0.5, 0), -- Position of the grid container
	Size = UDim2.fromScale(0.25, 0.5), -- Size of the grid container

	Metadata = {
		-- Here you are free to store any values you want.
	}
})

local transferGrid = GridPack.createGrid({
	Parent = screenGui,

	Visible = true,

	GridSize = Vector2.new(8, 15),
	SlotAspectRatio = 1,

	AnchorPoint = Vector2.new(1, 0.5),
	Position = UDim2.new(1, -20, 0.5, 0),
	Size = UDim2.fromScale(0.25, 0.5),
})

local transferLink = GridPack.createTransferLink({}) -- Create TransferLink
grid:ConnectTransferLink(transferLink) -- Connect TransferLink to our first grid.
transferGrid:ConnectTransferLink(transferLink) -- Connect the TransferLink to our new grid.


local item = GridPack.createItem({
	Position = Vector2.new(0, 0), -- Position in a grid.
	Size = Vector2.new(2, 3), -- Size in a grid.
	
	Metadata = {
		-- Here you are free to store any values you want.
	},
})

grid:AddItem(item) -- Add the item to the grid.
1 Like

I found out that the visible property wasn’t being applied correctly and defaulted to false. I’ve now published a new version which fixes this bug! You can find it here: Release Release v0.1.1-alpha · Frexsim/grid-pack · GitHub

Also be sure to update your script with screenGui.ZIndexBehavior = Enum.ZIndexBehavior.Sibling to avoid a white inventory, which is another “bug” I found in the tutorial while I was working on the fix.

Your new script with the changed ZIndexBehaviour:

local GridPack = require(game:GetService("ReplicatedStorage").Packages.GridPack)

local screenGui = Instance.new("ScreenGui")
screenGui.Name = "GridPack"
screenGui.ZIndexBehavior = Enum.ZIndexBehavior.Sibling -- CanvasGroup's GroupColor3 property doesn't work with global zindex behaviour and the inventory interface gets messed up
screenGui.ResetOnSpawn = false
screenGui.Parent = game:GetService("Players").LocalPlayer.PlayerGui

local grid = GridPack.createGrid({
	Parent = screenGui, -- Parent of the grid container

	Visible = true, -- If the grid is visible, changes the containers visible property. Also disables item interaction on all items inside.
	GridSize = Vector2.new(8, 15), -- How many slots the grid has on the X and Y axes.
	SlotAspectRatio = 1, -- Aspect ratio of one slot in the grid, helps with different resolutions if you're using scale instead of offset.

	AnchorPoint = Vector2.new(0, 0.5), -- Anchor point of the grid container
	Position = UDim2.new(0, 20, 0.5, 0), -- Position of the grid container
	Size = UDim2.fromScale(0.25, 0.5), -- Size of the grid container

	Metadata = {
		-- Here you are free to store any values you want.
	}
})

local transferGrid = GridPack.createGrid({
	Parent = screenGui,

	Visible = true,

	GridSize = Vector2.new(8, 15),
	SlotAspectRatio = 1,

	AnchorPoint = Vector2.new(1, 0.5),
	Position = UDim2.new(1, -20, 0.5, 0),
	Size = UDim2.fromScale(0.25, 0.5),
})

local transferLink = GridPack.createTransferLink({}) -- Create TransferLink
grid:ConnectTransferLink(transferLink) -- Connect TransferLink to our first grid.
transferGrid:ConnectTransferLink(transferLink) -- Connect the TransferLink to our new grid.


local item = GridPack.createItem({
	Position = Vector2.new(0, 0), -- Position in a grid.
	Size = Vector2.new(2, 3), -- Size in a grid.

	Metadata = {
		-- Here you are free to store any values you want.
	},
})

grid:AddItem(item) -- Add the item to the grid.
1 Like

It seems that inputting my own GuiObject under the asset slot for an item does not utilize it and results in using the default GuiObject, I am unsure if this happens to the grids & slots. I copied and pasted the code from the “_createDefaultSlotAsset” function and replaced the ImageLabel, parented the ItemElement under the LocalScript in StarterGUI, and added Assets.Slot to the GridPack.createItem().

I can’t wait for the full release of this module, it will be super helpful in a project I plan on working on! Good luck! :smiley: I’ll keep messing around with this to find more bugs/etc and post here or more than likely under GitHub so I’m not cluttering this forum up.

local item5 = GridPack.createItem({
	Position = Vector2.new(3, 12), -- Position in a grid.
	Size = Vector2.new(2, 3), -- Size in a grid.
	Assets = {
		Slot = script.ItemElement -- Add your own GuiObject here to customize the slot.
	},
	Metadata = {
		-- Here you are free to store any values you want.
	},
})
1 Like

Moving all future conversations here: GridPack - Create Grid/Tetris Style Inventories

2 Likes

might implement this into my inv system if I ever create an rpg game XD

1 Like