hello, I’m having problems with DataStores, How do I save and get the “PlayerStats” values? (Most of the words are in Portuguese, because I’m from Brazil, but ignore it!)
local DS = game:GetService("DataStoreService"):GetDataStore("PlayerData")
local PlayerStats = {
["Slots"] = {
["1"] = "Fire",
["2"] = "Water",
["3"] = "Wind" },
["Roupas"] = {
["Cabelo"] = 2,
["Camisa"] = 7,
["Calça"] = 3,
["Rosto"] = 1},
["Level"] = 12,
["Abilitys"] = 4
}
game.Players.PlayerAdded:Connect(function(Player)
local Key = "Player_"..Player.UserId
local Data = DS:GetAsync(Key)
if Data then
print(Data["Slots"]["1"]) -- How do I get this value?
end
end)
game.Players.PlayerRemoving:Connect(function(Player)
local Key = "Player_"..Player.UserId
local Sucesso, Erro = pcall(function()
DS:SetAsync(Key,PlayerStats)
end)
if Sucesso then
print("Salvou com Sucesso")
else
warn(Erro)
end
end)