I'm trying to make a skin system that saves the values of your skins. When testing, however, my script didn't work, and I kept getting the error print. Here is my script:
local DSS = game:GetService("DataStoreService")
local SkinDataStore = DSS:GetDataStore("SkinStore")
game.Players.PlayerAdded:Connect(function(player)
wait(1)
local Skins = Instance.new("Folder")
Skins.Name = "Skins"
Skins.Parent = player
local RoyaleMtar = Instance.new("StringValue")
RoyaleMtar.Name = "RoyaleMtar"
RoyaleMtar.Parent = Skins
local DesertPGH = Instance.new("StringValue")
DesertPGH.Name = "DesertPGH"
DesertPGH.Parent = Skins
local Id = "Player_"..player.UserId
local SkinData
local success, errormessage = pcall(function()
SkinData = SkinDataStore:SetAsync(Id)
end)
if success then
RoyaleMtar.Value = SkinData
DesertPGH.Value = SkinData
print("hi" )
else
print("error")
warn(errormessage)
end
end)
game.Players.PlayerRemoving:Connect(function(player)
local Id = "Player_"..player.UserId
local data = player.Skins.RoyaleMtar.Value
local data1 = player.Skins.DesertPGH.Value
local success, errormessage = pcall(function()
SkinDataStore:SetAsync(Id, data, data1)
end)
if success then
print("Skins Saved")
else
print("Skins failed to save")
warn(errormessage)
end
end)

1 comment
ah! ty, ill test it.