Inventory system not working properly

I’m working on an inventory system for my game and for a possibility for a variety of reasons it’s not allowing for me to add items to my dictionary in my datastore instead popping up with some weird string that doesn’t mean anything. How can I fix it so it properly adds to the dataStore and doesn’t add strange and unknown strings that don’t mean anything?

--Bindable functions I used to add the skin, more precisely the Red_SSS_Added
--If it helps I use Suphiis Datastore Module.

Screenshot 2025-03-26 132929

--Local functions I used to add the skins, in comments for AddSkinOrItem is what I used to add the skin. 
--Do not worry about the RemoveSkinOrItem as it didnt function.

Screenshot 2025-03-26 132936

--Weird string popping up that im 99% sure doesn't mean anything unless the string is a uuid, but I cant tell.

Screenshot 2025-03-26 132951

--Skin in Skin's dictionary i'm trying to add.
1 Like

image
In this screenshot, you’re calling AddSkinOrItem() using the dictionary of the item instead of the item’s name.

The weird string you see in the output is the table’s hexadecimal memory address.

3 Likes

Could you elaborate further via the code I used to add the memory address was

player_skin_inventory[Game_Skins["Red SSS"] = true

and a possible solution to my issue of not being able to add

["Red SSS"]

To the dictionary.

Also thanks, this clears up some of my confusion.

1 Like

Replace Game_Skins["Red SSS"] with just "Red SSS"
Your function AddSkinOrItem is supposed to take a datastore, and the name of a skin to add to the datastore, but you were calling it with the item’s dictionary, and not its name.

1 Like

but the skin “Red SSS” is in the table game_skins.
I may have coded it a bit weird but the datastore mentioned is really just the Skins table that is saved via the datastore. How can I get the [“Red SSS”] table cloned to the player_skin_inventory?

1 Like

as said before, that is the table’s memory address

try disabling this in the output’s settings
image

well this is odd, I’m having the same issue with printing :thinking:

1 Like

If that’s the case then don’t make a dictionary of booleans indexed by tables, that is kinda strange. All you need to do is use table.insert().

table.insert(player_skin_inventory, [Game_Skins["Red SSS"])
3 Likes

Originally, I had assumed this wouldn’t work due to player_skin_inventory and Red SSS being a dictionary and typically table.insert being used for arrays but this worked. Thanks G

1 Like

Nope, tables can contain any value type, and therefore you can use table.insert() to insert any value type into any table

1 Like

Oh wait nvm, My theory was partially correct? The Red SSS had inserted itself into the table

table.insert(player_skin_inventory, [Game_Skins["Red SSS"])

via the line above but without a Name causing the following to happen.
Screenshot 2025-03-26 163438
The 2 skins are 2 Red SSS’s but for some strange commonity do not display names. Any help on where to go from here? Im in studio as I speak trying to come up with a fix.

1 Like

How are you checking for the skin? Do the inserted skin dictionaries not contain the Skin_Name key as shown in your post?

1 Like

I check for the skin name via the following if statement;
image
The issue I seem to be having

table.insert 

comes down to the simple fact that table.insert inserts data into tables as if said table was an array and not a dictionary. I’m attempting to find a way to insert data via an alternate method into the table as if it was a dictionary and not default to an array.

1 Like

Wouldn’t it be dataStore.Value? You’re using SDM right?

1 Like

wait your right, but it would be dataStore.Value.Skin_Inventory[“Red SSS”].
Let me check what I defined dataStore as mentioned previously.

2 Likes

table.insert() uses numerical indices, if you want to check for items of a given name, you will have to use a loop to check for the Skin_Name value of each skin dictionary.

2 Likes

That setting is for changing how tables are printed in the output, with that setting on, printing a table will print its memory address rather than its contents.

However, if you have a dictionary which contains a value indexed by a table, the printed result will use the table’s hexadecimal address regardless. Example:
image
As far as I know, there is no way to change this behavior, even with the __tostring metamethod interestingly enough.

2 Likes

You’re right but due to the bug mentioned previously due to how I inserted data into the table no effect changed in the outcome.

1 Like

Alright i’ll change the way I check if an item is there. But as stated previously, no real way i’ve seen so far to import tables and data from the Game_Skins dictionary to the Skin_Inventory dictionary.

1 Like

You insert the dictionaries using table.insert(), if you click the > {. . .} in the output, they will expand and show you their contents.

1 Like

I’ve found the solution, turns out from my digging there is no real way to import a dictionary table into another dictionary so I’ve came up with a solution similar to you. Every time the Inventory is called, I will check for the skin and see if there if the skin’s name is there.