recently ive been developing a game and today i came across this issue where data cant be saved because of an issue in which player object cannot be indexed at all. using the :getchildren() method leads to an empty table. this is despite the fact that player is still returned as a valid argument, and that it is the type userdata.
the most odd thing was that yesterday the same script was working, and i used the same format for other games and they all have the same issue today which is affecting datastores. please fix it asap.
local function save(player)
local success, pdata
local kills = player.leaderstats.Kills
repeat
reqbudgetwait(Enum.DataStoreRequestType.SetIncrementAsync)
success, pdata = pcall(function()
database:UpdateAsync(player.UserId, function()
local newData
newData = {
["Kills"] = kills.Value,
}
return newData
end)
end)
until success
repeat
reqbudgetwait(Enum.DataStoreRequestType.SetIncrementAsync)
success, pdata = pcall(function()
database2:UpdateAsync(player.UserId, function()
local data = {}
local bodycolors = player.BodyColors
for _, property in ipairs(properties) do
local color = bodycolors[property]
if color then
data[property] = {color.R ,color.G, color.B}
end
end
return data
end)
end)
until success
end
Players.PlayerAdded:Connect(setup)
Players.PlayerRemoving:Connect(function(player)
print("e")
save(player)
end)
local function ServerShutdown()
for i, player in ipairs(Players:GetPlayers()) do
print("g")
save(player)
end
end
game 1:
game2: