Cannot store Instance in data store. Data stores can only accept valid UTF-8 characters?
I was trying to save data for a minigame and I get an error. Can anyone fix it? Thanks.
01 | local DataStoreService = game:GetService( "DataStoreService" ) |
02 | local experienceStore = DataStoreService:GetDataStore( "MinigamePoints" ) |
03 | game.Players.PlayerAdded:Connect( function (plr) |
04 | local coins = Instance.new( "IntValue" ,plr) |
06 | local key = "id-" ..plr.UserId |
07 | local savedcoins = experienceStore:GetAsync(key) |
11 | local coinssaving = { coins.Value } |
12 | experienceStore:SetAsync(key,coins) |
15 | game.Players.PlayerRemoving:Connect( function (plr) |
16 | local key = "id-" ..plr.UserId |
17 | local save = { plr.Coins.Value } |
18 | experienceStore:SetAsync(key,save) |