Hi, i made a skin inventory system, and i thought everything worked but it spewed out the data as 'nil', can anyone help?
local dsservice = game:GetService("DataStoreService")
local skinsdatastore = dsservice:GetDataStore("JuggernautSkinsDewretoz2019")
local skinTemplate = game.ReplicatedStorage.SkinTemplate
game.Players.PlayerAdded:Connect(function(plr)
plr.CharacterAdded:Connect(function(char)
local ownedSkins = Instance.new("Folder")
ownedSkins.Name = "PlayerSkins"
ownedSkins.Parent = plr
local key = "key-"..plr.UserId
local data = {}
data = skinsdatastore:GetAsync(key)
if data ~= nil then
for i,v in pairs(data) do
print(v.Name)
local nskin = game.ReplicatedStorage:FindFirstChild(v.Name):Clone()
nskin.Parent = ownedSkins
end
else
print(plr.Name.." has no skins to load")
end
end)
end)
game.Players.PlayerRemoving:Connect(function(plr)
local skinsToSave = {}
local key = "key-"..plr.UserId
for _, skin in pairs(plr.PlayerSkins:GetChildren()) do
table.insert(skinsToSave,skin.Name)
end
skinsdatastore:SetAsync(key,skinsToSave)
end)

1 comment
You are saving a string and trying to get the name property of it, which strings dont have