Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

Data Store is giving errors? (Data stores can only accept valid UTF-8 characters.)

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

0

I am getting the same error. Not sure why.

0

Try only saving the deaths and not the the p.TeamColor and see if it works?

1 answer

✓ Accepted answer

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.

2 comments

0

Thank you very much, that worked! It just occured to me that the TeamColor is a BrickColor instead of a string.

0

Happy to help :)

This discussion is preserved as it was. New answers, comments, and votes are closed.