Error 104: "Data stores only accept valid UTF-8 character"

I was working on a leaderboard system, I have little to no experience with datastores.

Here’s what the error looks like:

And here’s what’s causing it:

                place = 0
                newtable = {}
                ranking = 0
                for _,v in ipairs(HighestDonos) do
                    place = place+1
                    if Current~=nil then
                        if v[2].UserId~=player.UserId then
                            if Current>v[2] then
                                ranking = place
                            else
                                table.insert(newtable,place,v)
                            end
                        end
                    end
                end
                table.insert(newtable,ranking,{player, Current})
                table.remove(newtable,ranking-1)
                SaveData(Highest,HighestKey,newtable)

Any ideas??

1 Like

You cant save arrays or tables to datastores.
You have to encode them to json
HttpsService:JsonEncode()

1 Like

No, you can save tables to datastores.

1 Like

What’s “HighestDonos” and “Current” set to? You can’t save objects in a Datastore, only tables, strings, numbers and booleans.

Can you show us the SaveData() function and make sure you’re storing values and not objects.

Current = PriceOfPass + ( This value would be how much the player has purchased in the past)

Sorry, I was storing the players object value instead of their UserId.

1 Like