Hi all,
I am currently working on a very simple accessory shop for my sport game.
Since I recently got uncurable PTSD from Roblox’s DataStore, I now rely 100% on DataStore2.
So, how I proceed to save the player’s inventory is simple. Here inventoryFolder refers to a Folder located inside the player instance and its inside is bunch of string values that share the same name as the item stored inside ServerStorage. When you make a purchase, this ChildAdded event fires.
inventoryFolder.ChildAdded:Connect(function(v)
local playersVisors = {}
for _,v in pairs(inventoryFolder:GetChildren()) do
table.insert(playersVisors, v.Name)
end
print(playersVisors)
dataVisors:Set(playersVisors)
end)
When I print the table, all the values are as they should be except for the last one. The last one shows up as “Value” and, thus failing to load when the player rejoins as there is no item called “Value” inside the serverstorage. I’m guessing that is because as soon as the stringValue is created inside the folder, the event fires before the purchase script changes its name.
What I think would work is adding some sort of wait() inside the event but this is what I want to avoid. My question is the following: Is there any better alternative to solve this problem
Thanks in advance!