Ad
Log in to vote
0

Fix? - Cannot store Instance in data store. Data stores can only accept valid UTF-8 characters.

Asked by 1 month ago

Script

for i,v in pairs(game.Workspace.Teleports:GetChildren()) do
    local dss = game:GetService("DataStoreService")
    local sv = dss:GetDataStore("Save1")

        game.Players.PlayerAdded:Connect(function(plr)
            local SetSuccess, errormessage = pcall(function()
            local PortalData = sv:SetAsync(plr.UserId,v)
        end)
        if not SetSuccess then
            warn(errormessage)

            local GetSuccess, amount = pcall(function()
                return sv:GetAsync(plr.UserId)
            end)
            if GetSuccess then
                print(amount)
            end
        end
    end)
end

1 answer

Log in to vote
0
Answered by 1 month ago

You should first know what you can save inside a data store, you cannot save an instance inside of it. Instead I'd recommend saving it's name(string), and getting the instance from a table or use your own ways. Also, I'd recommend don't making many data stores, just make one, and save each value with a different key using only one data store.

Ad

Answer this question