Cannot store Array in data store. Data stores can only accept valid UTF-8 characters.
I Don't Understand What That Means
Help!
Cannot store Array in data store. Data stores can only accept valid UTF-8 characters.
I Don't Understand What That Means
Help!
You are saving the object itself, not the value that the object holds. So, you should be using .Value after the object to get the value that the object contains.
Line 20 should look like this
DS:SetAsync("plrid_"..plr.userId, {plr.leaderstats.Steps.Value, plr.leaderstats.Races.Value})
And that will save the value of the object.
Hope this helped! If this worked, don't forget to select this as the answer!
Here Is The Script:
local DS = game:GetService("DataStoreService"):GetDataStore("PermPlrDataV1.0")
game.Players.PlayerAdded:Connect(function(plr)
wait(0)
local plrkey = "plrid_"..plr.userId
local savevalue = plr.leaderstats.Steps
local savevalue2 = plr.leaderstats.Races
local GetSaved = DS:GetAsync(plrkey)
if GetSaved then
savevalue.Value = GetSaved[1]
savevalue2.Value = GetSaved[2]
else
local NumbersForSaving = {savevalue.Value, savevalue2.Value}
DS:GetAsync(plrkey, NumbersForSaving)
end
end)
game.Players.PlayerRemoving:Connect(function(plr)
DS:SetAsync("plrid_"..plr.userId, {plr.leaderstats.Steps, plr.leaderstats.Races})
end)
so Like this?
local DS = game:GetService("DataStoreService"):GetDataStore("PlrDataV1.0.0")
game.Players.PlayerAdded:Connect(function(plr)
wait()
local plrkey = "id_"..plr.userId
local savevalue = plr.leaderstats.Points
local savevalue2 = plr.leaderstats.Prestige
local savevalue3 = plr.Code
local GetSaved = DS:GetAsync(plrkey)
if GetSaved then
savevalue.Value = GetSaved[1]
savevalue2.Value = GetSaved[2]
savevalue3.Value = GetSaved[3]
else
local NumbersForSaving = {savevalue.Value, savevalue2.Value, savevalue3.Value}
DS:GetAsync(plrkey, NumbersForSaving)
end
end)
game.Players.PlayerRemoving:Connect(function(plr)
DS:SetAsync("id_"..plr.userId, {plr.leaderstats.Points.Value, plr.leaderstats.Prestige.Value, plr.Code.Value})
end)
You have to save their values, not the object itself. On line 20, after Steps and Races put .Value to save the value of those objects.
you mean like this?
Yes, you have to save the values of the objects, not the objects itself.
This discussion is preserved as it was. New answers, comments, and votes are closed.
2 comments
Thanks It Worked
No problem!