So Hopefully smiley the guy who helped me with datastore sees this he may be able to help.
Well this DataStore half of the time it does not save the stats, so is there any way to get this bug out guys?
heres the code
Data=game:GetService("DataStoreService"):GetDataStore("Stats")--change points to whatever
local stats = {"Ki", "Physical", "Agility"}
game.Players.PlayerAdded:connect(function(player)
local leaderstats = Instance.new("Model", player)
leaderstats.Name = "leaderstats"
for _, stat in pairs(stats) do
a=Instance.new("IntValue", leaderstats)
a.Name = stat
a.Value=Data:GetAsync(player.userId..stat)
a.Changed:connect(function(value)
Data:SetAsync(player.userId..stat,value)
end)
end
end)
|