Cannot store Instance in data store. Data stores can only accept valid UTF-8 characters. second script:
local ds = game:GetService("DataStoreService"):GetDataStore("Data") game.Players.PlayerAdded:Connect(function(plr) local key = plr.UserId.."_id" local save = plr.stats.ins local savel = ds:GetAsync(key) if savel then save.Value = savel[1] else local nfs = {save} ds:GetAsync(key, nfs) end end) game.Players.PlayerRemoving:Connect(function(plr) local key = plr.UserId.."_id" local save = plr.stats.ins ds:SetAsync(key, save) end)
first script:
game.Players.PlayerAdded:Connect(function(plr) local folder = Instance.new("Folder", plr) folder.Name = "stats" local ins = Instance.new("NumberValue", folder) ins.Name = "ins" ins.Value = 1 end)
Second script:
local ds = game:GetService("DataStoreService"):GetDataStore("Data") game.Players.PlayerAdded:Connect(function(plr) local key = plr.UserId.."_id" local save = plr.stats.ins local savel = ds:GetAsync(key) if savel then save.Value = savel[1] else local nfs = {save} ds:GetAsync(key, nfs) end end) game.Players.PlayerRemoving:Connect(function(plr) local key = plr.UserId.."_id" local save = plr.stats.ins.Value ds:SetAsync(key, save) end)
Fixed :D