So, I'm trying to save the amount of deaths a player has and the team color that it's on when it leaves. here's the code I have. (By the way, this is only a portion of the whole script.)
game.Players.PlayerRemoving:Connect(function(p)
local data = {deaths = p.leaderstats.Deaths.Value,team = p.TeamColor}
ds:SetAsync(p.UserId,data)
end)
Here's the output:
15:44:21.741 - 104: Cannot store Dictionary in data store. Data stores can only accept valid UTF-8 characters. Script 'ServerScriptService.Main', Line 29.
Does anyone know what's going on? Any help is appreciated.

2 comments
I am getting the same error. Not sure why.
Try only saving the deaths and not the the p.TeamColor and see if it works?