Skins saving not working

Hello,
I’m trying to save a players owned skins! But it’s not working!
Getting script:

	if SkinsStore ~= nil then
		for _, OwnedSkin in pairs(SkinsStore) do
			local Skin = Instance.new('StringValue',Player)
			Skin.Name = OwnedSkin
		end
	end

Saving script:

		for _, OwnedSkin in pairs(OwnedSkins:GetChildren()) do
			dStore:SetAsync(Player.UserId..'OwnedSkins',OwnedSkin.Name)
		end

The error:

How else can I load everything inside a folder and save it??

1 Like

I’m trying to load every skin the player owns, but I’m not sure how else I can load it? Can someone tell me how to load it?

I have a script from my game I use to save a players weapons. You can adjust this to how you need it.

local dss = game:GetService("DataStoreService")
local toolsDS = dss:GetDataStore("WeaponsData")

local toolsFolder = game.ServerStorage.ToolsFolder

game.Players.PlayerAdded:Connect(function(plr)
	
	local savedTools = toolsDS:GetAsync(plr.UserId) or {}
	
	for i, savedTool in pairs(savedTools) do
			
		if toolsFolder.Primary:FindFirstChild(savedTool) then 
			toolsFolder.Primary[savedTool]:Clone().Parent = plr:WaitForChild("OwnedWeapons")
		end
	end
	
	plr.CharacterRemoving:Connect(function(char)
    	
		char.Humanoid:UnequipTools()
    end)
end)


game.Players.PlayerRemoving:Connect(function(plr)
	
	local savedTools = {}
	
	for i, savedTool in pairs(plr.OwnedWeapons.Primary:GetChildren()) do
		
		table.insert(savedTools, savedTool.Name)
	end
	
	local success, errormsg = pcall(function()
		
		toolsDS:SetAsync(plr.UserId, savedTools)
	end)
	if errormsg then warn(errormsg) end
end)
1 Like