im trying to add another datastore but it just shows this error.
this is my script
local dataStoreService = game:GetService("DataStoreService")
local PlayerStats = dataStoreService:GetDataStore("StatSave")
game.Players.PlayerAdded:Connect(function(player)
local playerstats = Instance.new("Folder")
playerstats.Name = "playerstats"
playerstats.Parent = player
playerstats:SetAttribute("Strength", 1) -- done
playerstats:SetAttribute("Protection", 1) -- done
playerstats:SetAttribute("Dexterity", 1) -- done
playerstats:SetAttribute("Sorcery", 1)
playerstats:SetAttribute("Charisma", 1) -- done
playerstats:SetAttribute("Intelligence", 1)
playerstats:SetAttribute("Damage", 1) -- done
playerstats:SetAttribute("Stats", 200)
local strengthdata, protectiondata, dexteritydata, sorcerydata, charismadata, intelligencedata, damagedata, statsdata
local success, errormessage = pcall(function()
strengthdata = PlayerStats:GetAsync(player.UserId.."-Strength")
protectiondata = PlayerStats:GetAsync(player.UserId.."-Protection")
dexteritydata = PlayerStats:GetAsync(player.UserId.."-Dexterity")
sorcerydata = PlayerStats:GetAsync(player.UserId.."-Sorcery")
charismadata = PlayerStats:GetAsync(player.UserId.."-Charisma")
intelligencedata = PlayerStats:GetAsync(player.UserId.."-Intelligence")
damagedata = PlayerStats:GetAsync(player.UserId.."-Damage")
statsdata = PlayerStats:GetAsync(player.UserId.."-Stats")
end)
if success then
playerstats:SetAttribute("Strength", strengthdata)
playerstats:SetAttribute("Protection", protectiondata)
playerstats:SetAttribute("Dexterity", dexteritydata)
playerstats:SetAttribute("Sorcery", sorcerydata)
playerstats:SetAttribute("Charisma", charismadata)
playerstats:SetAttribute("Intelligence", intelligencedata)
playerstats:SetAttribute("Damage", damagedata)
playerstats:SetAttribute("Stats", statsdata)
else
print("Error.")
warn(errormessage)
end
end)
game.Players.PlayerRemoving:Connect(function(plr)
local success, errormessage = pcall(function()
PlayerStats:SetAsync(plr.UserId.."-Strength", plr.playerstats:GetAttribute("Strength"))
PlayerStats:SetAsync(plr.UserId.."-Protection", plr.playerstats:GetAttribute("Protection"))
PlayerStats:SetAsync(plr.UserId.."-Dexterity", plr.playerstats:GetAttribute("Dexterity"))
PlayerStats:SetAsync(plr.UserId.."-Sorcery", plr.playerstats:GetAttribute("Sorcery"))
PlayerStats:SetAsync(plr.UserId.."-Charisma", plr.playerstats:GetAttribute("Charisma"))
PlayerStats:SetAsync(plr.UserId.."-Intelligence", plr.playerstats:GetAttribute("Intelligence"))
PlayerStats:SetAsync(plr.UserId.."-Damage", plr.playerstats:GetAttribute("Damage"))
PlayerStats:SetAsync(plr.UserId.."-Stats", plr.playerstats:GetAttributes("Stats"))
end)
if success then
print("Saved PlayerData!")
else
print("Error with saving PlayerData.")
warn(errormessage)
end
end)