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.
This is because you cannot store a userdata value using SetASync(), and by userdata value im referring to the teamcolor.
What you can do instead is store the teamcolor as a string so
tostring(p.TeamColor)
and then when you get the data you can just find the team through the "Name" of the teamcolor.
Hope this helped, if you have any questions please let me know.