I'm trying to make an ingame friend system, and it's sadly not working. I'm trying to use this bit of code to update the friends datastore to say that I'm offline.. And playerData always gets nil.

function DataStore:UpdateStatus(player, isOnline)
	for i = 1, #sessionData[player] do
		local friendID = game.Players:GetUserIdFromNameAsync(sessionData[player][i]["Name"])
		if friendID ~= nil then
			output(player, ":", friendID)
		end
		
		local playerData = FriendData:GetAsync(friendID)
		
		output("DEBUG", playerData, #playerData)
		
		if playerData ~= nil then
			for i2 = 1, #playerData do
				for i3 = 1, #playerData[i2] do
					if playerData[i2][i3]["Name"] == player.Name then
						playerData[i2][i3]["Online"] = isOnline
					end
				end
			end
			
			for a = 1, #playerData do
				for b = 1, #playerData[a] do
					output("DEBUG", a, b)
				end
			end
			
			FriendData:SetAsync(game.Players:GetUserIdFromNameAsync(sessionData[player][i]["Name"], playerData))
		end
	end
end