What do you want to achieve? Keep it simple and clear!
Save a folder with skins owned in the player with the children
What is the issue? Include screenshots / videos if possible!
I can’t save the children
What solutions have you tried so far? Did you look for solutions on the Developer Hub?
I tried seaching for it but i could not find the solution.
After that, you should include more details if you have any. Try to make your topic as descriptive as possible, so that it’s easier for people to help you!
-- local dataStoreCash = game:GetService("DataStoreService"):GetDataStore("MoneyData") -- Maakt de opslag aan voor de leaderstat
local dataStoreDiamonds = game:GetService("DataStoreService"):GetDataStore("DiamondsData") -- Maakt de opslag aan voor de leaderstat
local dataStoreSkins = game:GetService("DataStoreService"):GetDataStore("SkinsData") -- Maakt de opslag aan voor items die je hebt gekocht (garage)
starterCash = 0
starterDiamonds = 0
game.Players.PlayerAdded:Connect(function(plr)
local GarageSled = game.Workspace:WaitForChild("GarageSled")
local leaderstats = Instance.new("Folder") -- Maakt een map voor de leaderstats
leaderstats.Name = "leaderstats" -- maakt de naam voor de leaderstats
leaderstats.Parent = plr -- staat waar de leaderstats zijn
local money = Instance.new("IntValue")
money.Name = "Coins"
money.Value = dataStoreCash:GetAsync(plr.UserId) or starterCash
money.Parent = leaderstats
local Diamonds = Instance.new("IntValue")
Diamonds.Parent = leaderstats
Diamonds.Name = "Diamonds"
Diamonds.Value = dataStoreDiamonds:GetAsync(plr.UserId) or starterDiamonds
local OwnedSkins = Instance.new("Folder")
OwnedSkins.Name = "OwnedSkins"
OwnedSkins.Parent = plr
OwnedSkins.Children = dataStoreDiamonds:GetAsync(plr.UserId) -- i wanna load it here
end)
game.Players.PlayerRemoving:Connect(function(plr)
dataStoreCash:SetAsync(plr.UserId, plr.leaderstats.Coins.Value)
dataStoreDiamonds:SetAsync(plr.UserId, plr.leaderstats.Diamonds.Value) -
dataStoreSkins:SetAsync(plr.UserId, plr.OwnedSkins) -- i wanna save it here
end)
You could use a table that contains every single owned skins the player has, instead you get the skins’ name which is a string and use it for reference. When loading the data, you go to whatever parent that has the skins from and refer the table they had, which you have to iterate the table where each element is a string, then use :FindFirstChild(stringName) to get the skins they owned, in which you have to clone the skins first.