Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Tips for creating Inventory System using tables and dictionaries?

Asked by 5 years ago
Edited 5 years ago

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)

0
shut up man shinferno -53 — 5y
0
okay :c rainitey 0 — 5y
0
Dude why would you tell him to shut up? he is asking a question. vissequ 105 — 5y
0
Also I'm assuming you want it to save, yes? vissequ 105 — 5y
0
yes i am rainitey 0 — 5y

2 answers

Log in to vote
0
Answered by 5 years ago
Edited 5 years ago

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!

Ad
Log in to vote
0
Answered by
Patch 0
5 years ago

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.

```lua 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

Answer this question