So i have this function saving players characters as they leave the game, but when i try it out in studio my studio hangs for like 10 seconds and then returns this warning:
How would i be able to fix this? any help is appreciated!
local function playerRemoving(player)
local _characters = {}
local succes, err = pcall(function()
for i,v in pairs(player.CharacterShop.Characters:GetChildren()) do
table.insert(_characters, v.Name)
end
datastore:SetAsync(player.UserId.."Characters", _characters)
end)
if succes then
print("Succes!")
else
warn("Error")
end
end