I got warning and error by trying to save table to data store.
I tried to put Color3 value into table, but nothing changed.
Warning: “104: Cannot store Dictionary in data store. Data stores can only accept valid UTF-8 characters.”
Error: “DataStoreService: CantStoreValue: Cannot store Dictionary in data store. Data stores can only accept valid UTF-8 characters. API: SetAsync, Data Store: CarColor”
Also it is sever side script.
My script:
local DataStoreService = game:GetService("DataStoreService")
local ReplicatedStorageService = game:GetService("ReplicatedStorage")
local RemoteEvents = ReplicatedStorageService:WaitForChild("RemoteEvents")
local Event = RemoteEvents:WaitForChild("UpdateCarColor")
local DataStore = DataStoreService:GetDataStore("CarColor")
function saveData(plr,UpdatedColor)
if not plr:FindFirstChild("DATA FAILED TO LOAD") then
local compiledData = {}
compiledData.CarColor = UpdatedColor
local success, err = nil, nil
while not success do
success, err = pcall(function()
DataStore:SetAsync(plr.UserId, compiledData) --warning and error here
end)
if err then
warn(err)
end
task.wait(0.02)
end
end
end
Event.OnServerEvent:Connect(saveData)
Event fires when player change color of his car by using game menu.
Also if you want also other part of the script where i get the data i can give it to you.