Some Players in my game have complained about having their Data being changed on entering a different server,some aren't affected and some say that it happens when I use the shutdown all servers button . Apparently the intValues that the datastores are saving are being replaced by random numbers?
I can't seem to find anything wrong with the scripts. I'm hoping someone else can review my script and reassure this should work as intended.
local saveAs = "HS"
local dataStore = game:GetService("DataStoreService"):GetDataStore(saveAs)
local Players = game:GetService("Players")
Players.PlayerAdded:connect(function(player)
local stats = player:WaitForChild("Hstats")
local data = dataStore:GetAsync(player.UserId)
if data then
for name,value in next, data do
stats[name].Value = value
end
end
end)
Players.PlayerRemoving:connect(function(player)
local stats = player:FindFirstChild("Hstat")
if stats then
local data = {}
for _,stat in ipairs(stats:GetChildren()) do
data[stat.Name] = stat.Value
end
dataStore:SetAsync(player.UserId,data)
end
end)
while wait(61) do
for _, player in pairs(game.Players:GetChildren()) do
local stats = player:FindFirstChild("Hstat")
if stats then
local data = {}
for _,stat in ipairs(stats:GetChildren()) do
data[stat.Name] = stat.Value
end
dataStore:SetAsync(player.UserId,data)
end
end
end
game.OnClose = function()
wait(10)
end

2 comments
Did not know about that o_o thanks for letting me know.
Im sorry, but according to the wiki, and some other person, it can only be changed from your game/universe. But thats still the only reason I can think of without seeing your script to get the info.