local ds = game:GetService("DataStoreService"):GetDataStore("LeaderStats")
Game.Players.PlayerAdded:connect(function(plr)
local ls = Instance.new("IntValue")
ls.Name = "leaderstats"
ls.Parent = plr
local stat = Instance.new("IntValue")
stat.Parent = ls
stat.Value = ds:GetAsync(plr.userId.."_Tester")
stat.Name = "Tester"
end)
game.Players.PlayerRemoving:connect(function(plr)
ds:SetAsync(plr.userId.."_"..child[i].Name,plr.leaderstats["Tester"].Value)
end)
--------------------------------
01:26:17.875 - ServerScriptService.DataStoreTest:9: attempt to index upvalue 'ds' (a nil value) |