Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

Tips for creating Inventory System using tables and dictionaries?

Hello! I'm currently making a survival game in Roblox but I've hit a roadblock. I'm new scripting use LUA. I'm not sure how to create a basic inventory and I'm looking for a point in the right direction. I've researched tables but I'm not making the connection :c I put the set up I have going on as images in this post. https://ibb.co/QdwbT5T (https://ibb.co/w7qPwgB)

5 comments

0

shut up man

0

okay :c

0

Dude why would you tell him to shut up? he is asking a question.

0

Also I'm assuming you want it to save, yes?

0

yes i am

2 answers

So hope this works and that you will get better at lua. heres how to make a table:

local TestTable = {value1,value2,value3}

you can insert as many values as you would like. This is an array table by the way. I did not name the table variable 'table' because table is a keyword in lua. Please mark as answered if this helped!

The best thing to do is to create all of the frames automatically and handle it all in a for loop. That's what I do, at least.

for X = 1, 4 do
	for Y = 1, 12 do
		local Frame = Instance.new("Frame")
		Frame.Size = UDim2.new(0, 50, 0, 50)
		Frame.Posititon = UDim2.new(0, 50 * X + 10, 0, 50 * Y + 10)
		
		-- Recommended to add a TextButton but make it transparent to handle clicking and stuff
		Button.MouseButton1Click:Connect(function()
			-- When an inventory button is clicked...
		end)
	end
end

Hope this helps.

Patch

This discussion is preserved as it was. New answers, comments, and votes are closed.