What do I want to achieve?
Basically, I have this 1 folder parented to the player once joined called “OwnedItems”, that folder holds everything you’ve bought from the in-game shop, I also want to use folders because it’s way easier to handle inventory systems that way.
What is the issue?
I basically do not know how to datastore a folder with descendants, I’ve looked up some more forums about it but yet again I can’t seem to understand / comprehend what they were doing, so if you would like to help me keep it simple and clear.
What solutions have I tried so far?
I’ve tried couple but they wouldn’t make sense as I was just messing around to see if I would have an outcome.
-- Upon joinining:
local coinsData
local successCoins, ErrorCoins = pcall(function()
coinsData = game:GetService("DataStoreService"):GetDataStore("-"):GetAsync(player.UserId)
end)
if coinsData then
coins.Value = coinsData
else
warn(ErrorCoins)
end
-- Once changed
coins.Changed:Connect(function()
game:GetService("DataStoreService"):GetDataStore("-"):SetAsync(player.UserId, player.ValueStats.Coins.Value)
end)
-- Upon leaving
local coinsData
local successCoins, ErrorCoins = pcall(function()
coinsData = game:GetService("DataStoreService"):GetDataStore("-"):SetAsync(player.UserId, player.ValueStats.Coins.Value)
end)
if successCoins then
else
warn(ErrorCoins)
end
I’m asking help to see if y’all can convert my datastore code into something that datastores folders descendants, If you need anything just reply down below, appreciate it.
Note: the datastore script I put out works just fine, but if you see an issue you can always inform me about it