Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

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

Asked by 4 years ago

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.

0
I am getting the same error. Not sure why. appxritixn 2235 — 4y
0
Try only saving the deaths and not the the p.TeamColor and see if it works? Autechgames 6 — 4y

1 answer

Log in to vote
2
Answered by
Nanomatics 1160 Moderation Voter
4 years ago
Edited 4 years ago

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.

0
Thank you very much, that worked! It just occured to me that the TeamColor is a BrickColor instead of a string. Happy_Liam 64 — 4y
0
Happy to help :) Nanomatics 1160 — 4y
Ad

Answer this question