Hi, I want to create a second inventory system similar to what’s used in tower Defence games, but specifically designed to store players’ cards after they open card packs.
What I want to achieve?
A simple and reliable system that saves and displays all the cards a player collects from card packs in a separate inventory UI that displays above the normal inventory like in Ultimate Tower Defence. A button that opens a a bigger inv where you can like equip cards and check stats and rarities.
What is the issue?
I’m not sure how to structure the second inventory or connect it properly to the card pack opening process. I don’t have a working example or reference.
Solutions I have tried so far?
I have looked through the Creator Hub and tried some basic inventory scripts, but they don’t handle cards or link with the pack opening system. I also attempted to use tables to store cards but I’m unsure how to sync that with the GUI and save data.
Hi,
I don’t quite get the issue here. If you wanna make the slots from 1 - 6, just make the UI for each of them, and use a local script to detect when the player’s inventory changes, then update the slots accordingly.
No like the inventory im trying to make isnt for normal items and are for displaying what cards you have equipped as your current deck but im not that good at making stuff so i was trying to make a secondary inventory that could for equipping and seeing your cards and stuff, im sorry for the confusion im not the best at explaining
Ahhh, I get your issue now. Thanks for replying so quickly!
What you’re going to want to do is create a folder on the server inside each player when they join, and call it something like “Hotbar”. (kinda like this)
local players = game:GetService("Players")
players.PlayerAdded:Connect(function(player)
local hotbarFolder = Instance.new("Folder") --the whole slot inventory
hotbarFolder.Parent = player
hotbarFolder.Name = "Hotbar"
for count = 1, 6, 1 do
local newSlot = Instance.new("StringValue") -- For each slot there is the card's name
newSlot.Name = "Slot"..count --name it Slot1 - Slot6
newSlot.Parent = hotbarFolder
end
end)
And for the cards that you can equip, you can just create UI for it and use a UIGridLayout to format them into neat rows, then use a local script to detect when the button is clicked, and when it is, add that button to one of the player’s slots.
You can then use another local script to display what cards are in the player’s slots.
I’m not that kind of an experienced scripter myself, but I never tried taking on projects I didn’t know how to make. If you don’t feel confident enough to meet the expectations of the project you want to create, consider hiring someone to help rather than forcing yourself to patch every small problem with third party solutions. That approach won’t work in the long time run and you’ll notice this sooner or later.
It’s not about the money, it’s about the skill you have to provide for your projects.. I’m not trying to say that you shouldn’t try, I’m trying to say that you need to find ways to make your work easier, lowering some of your expectations, especially if you’re new to scripting or general game development