You can’t see it, but in studio the second success is underlined in blue (which I’m pretty sure means it’s undefined). However in the output there are no errors saying that success is undefined, so does that mean that it’s not even going through that line of code. Thanks
Players.PlayerRemoving:Connect(function(client)
print("PlayerLeft")
local key = "client_".. client.UserId
local tools = {}
local inventory_folder = inventories[client.Name]
for _, item in pairs(inventory_folder:GetChildren()) do
table.insert(tools, item.Name)
end
local success, data =
pcall(player_data.UpdateAsync, player_data, key, function(prev)
if not success then ---Success is underlined in blue
print(error) -- this print call will only run if success is false
else
return tools
end
end)
inventory_folder:Destroy()
end)